ListenerList
instead.
Please note that the ListenerList(int)
and
ListenerList.ListenerList(int)
constructors have different semantics. Please read the javadoc
carefully. Also note that the equivalent of
ListenerList()
is actually
ListenerList.ListenerList(int)
with ListenerList.IDENTITY
as
the argument.@Deprecated public class ListenerList extends ListenerList
Note that the add
method checks for and eliminates duplicates
based on identity (not equality). Likewise, the remove
method
compares based on identity.
Use the getListeners
method when notifying listeners. Note
that no garbage is created if no listeners are registered. The recommended
code sequence for notifying all registered listeners of say,
FooListener.eventHappened
, is:
Object[] listeners = myListenerList.getListeners(); for (int i = 0; i < listeners.length; ++i) { ((FooListener) listeners[i]).eventHappened(event); }
EQUALITY, IDENTITY
Constructor and Description |
---|
ListenerList()
Deprecated.
Creates a listener list with an initial capacity of 1.
|
ListenerList(int capacity)
Deprecated.
Creates a listener list with the given initial capacity.
|
public ListenerList()
public ListenerList(int capacity)
capacity
- the number of listeners which this list can initially accept
without growing its internal representation; must be at least
1
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.