L
- The listener type.@ThreadSafe
public final class Listeners<L>
extends Object
implements Iterable<L>
This container is specialized for objects acting as listeners. They are kept in their order of entry. Duplicate additions, recognized by their object identity, will be rejected.
It is assumed that the number of entries will be small and that addition/removal will be infrequent.
Constructor and Description |
---|
Listeners() |
Modifier and Type | Method and Description |
---|---|
boolean |
add(L listener)
Adds a listener if not already contained.
|
void |
clear()
Removes all listeners.
|
boolean |
isEmpty()
Asks if empty.
|
Iterator<L> |
iterator() |
boolean |
remove(L listener)
Removes a listener.
|
public boolean add(@Nonnull L listener)
listener
- The listener.public void clear()
@CheckReturnValue public boolean isEmpty()
public boolean remove(@Nonnull L listener)
listener
- The listener.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.