CALLBACKTYPE - The callback type.@ThreadSafe public class CallbackList<CALLBACKTYPE extends ICallback> extends Object implements ICallbackList<CALLBACKTYPE>, ICloneable<CallbackList<CALLBACKTYPE>>
| Constructor and Description |
|---|
CallbackList() |
CallbackList(CallbackList<CALLBACKTYPE> aOther) |
| Modifier and Type | Method and Description |
|---|---|
CallbackList<CALLBACKTYPE> |
addCallback(CALLBACKTYPE aCallback)
Add a callback.
|
void |
forEach(Consumer<? super CALLBACKTYPE> aConsumer)
Invoke all registered callbacks in a safe manner.
|
EContinue |
forEachBreakable(Function<? super CALLBACKTYPE,EContinue> aFunction)
A special version of
Iterable.forEach(Consumer) that can break iteration if
a certain requirement is fulfilled. |
ICommonsList<CALLBACKTYPE> |
getAllCallbacks() |
CALLBACKTYPE |
getCallbackAtIndex(int nIndex)
Get the callback at the specified index.
|
int |
getCallbackCount() |
CallbackList<CALLBACKTYPE> |
getClone() |
boolean |
hasCallbacks() |
Iterator<CALLBACKTYPE> |
iterator() |
EChange |
removeAllCallbacks()
Remove all callbacks
|
EChange |
removeCallback(CALLBACKTYPE aCallback)
Remove the specified callback
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontainsAny, containsNone, containsOnly, findAll, findAllInstanceOf, findAllMapped, findAllMapped, findAllMapped, findFirst, findFirst, findFirstMapped, findFirstMapped, forEach, forEach, getIteratorCount, getIteratorCountspliteratorpublic CallbackList()
public CallbackList(@Nonnull CallbackList<CALLBACKTYPE> aOther)
@Nonnull public CallbackList<CALLBACKTYPE> addCallback(@Nonnull CALLBACKTYPE aCallback)
aCallback - May not be null.@Nonnull public EChange removeCallback(@Nullable CALLBACKTYPE aCallback)
aCallback - May be null.EChange@Nonnull public EChange removeAllCallbacks()
EChange@Nonnull @ReturnsMutableCopy public ICommonsList<CALLBACKTYPE> getAllCallbacks()
getAllCallbacks in interface ICallbackList<CALLBACKTYPE extends ICallback>null and only
containing non-null elements.@Nullable public CALLBACKTYPE getCallbackAtIndex(@Nonnegative int nIndex)
ICallbackListgetCallbackAtIndex in interface ICallbackList<CALLBACKTYPE extends ICallback>nIndex - The index to be retrieved. Should be ≥ 0.null if the provided index is invalid.@Nonnegative public int getCallbackCount()
getCallbackCount in interface ICallbackList<CALLBACKTYPE extends ICallback>public boolean hasCallbacks()
hasCallbacks in interface ICallbackList<CALLBACKTYPE extends ICallback>true if at least a single callback is present,
false otherwise.@Nonnull public CallbackList<CALLBACKTYPE> getClone()
getClone in interface ICloneable<CallbackList<CALLBACKTYPE extends ICallback>>@Nonnull public Iterator<CALLBACKTYPE> iterator()
iterator in interface Iterable<CALLBACKTYPE extends ICallback>public void forEach(@Nonnull Consumer<? super CALLBACKTYPE> aConsumer)
ICallbackListforEach in interface ICallbackList<CALLBACKTYPE extends ICallback>forEach in interface Iterable<CALLBACKTYPE extends ICallback>aConsumer - The action to be performed with the respective callback. This method
cannot return a value. May not be null.@Nonnull public EContinue forEachBreakable(@Nonnull Function<? super CALLBACKTYPE,EContinue> aFunction)
ICommonsIterableIterable.forEach(Consumer) that can break iteration if
a certain requirement is fulfilled.forEachBreakable in interface ICommonsIterable<CALLBACKTYPE extends ICallback>aFunction - The consumer to be invoked. May not be null.EContinue.BREAK if iteration was stopped,
EContinue.CONTINUE otherwise.Copyright © 2014–2017 Philip Helger. All rights reserved.