what is the advantage of using EventListnerList over Vector ? Which is more preferred ?
Vector
is pseudo "deprecated" in favor of the collections API List
.List
may contain whatever you want it to without restrictionList
, it's management would be complicated, as you'd need to walk the list each time you wanted to find a given type of listener. You'd be better of using some kind of Map
, but then, you'd be duplicating what EventListenerList
does...EventListenerList
will allow you to manage multiple different types of EventListener
s, but is restricted to managing only class that implement the EventListener
interfacelistenerList
which is an instance of EventListenerList
as a protected
field, so you don't need to create your ownSo, I would suggest, you might use EventListenerListener
when...
EventListener
You might consider using a List
when...
EventListenerList
any way...