Package com.complexible.common.util
Class ListenerSupport<T extends java.util.EventListener>
- java.lang.Object
-
- com.complexible.common.util.ListenerSupport<T>
-
- All Implemented Interfaces:
java.lang.Iterable<T>
public final class ListenerSupport<T extends java.util.EventListener> extends java.lang.Object implements java.lang.Iterable<T>Base class for a collection of listeners
- Since:
- 1.0
- Version:
- 7.4
- Author:
- Michael Grove
-
-
Constructor Summary
Constructors Constructor Description ListenerSupport()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(T theListener)Adds the specified listener to the liststatic <T extends java.util.EventListener>
ListenerSupport<T>create()Create a new ListenerSupportvoidforEach(java.util.function.Consumer<? super T> action)java.util.Iterator<T>iterator()voidremoveListener(T theListener)Removes the specified listener from the list
-
-
-
Method Detail
-
addListener
public void addListener(T theListener)
Adds the specified listener to the list- Parameters:
theListener- the listener to add
-
removeListener
public void removeListener(T theListener)
Removes the specified listener from the list- Parameters:
theListener- the listener to remove
-
forEach
public void forEach(java.util.function.Consumer<? super T> action)
- Specified by:
forEachin interfacejava.lang.Iterable<T extends java.util.EventListener>
-
iterator
@Nonnull public java.util.Iterator<T> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<T extends java.util.EventListener>
-
create
public static <T extends java.util.EventListener> ListenerSupport<T> create()
Create a new ListenerSupport- Type Parameters:
T- the listener type- Returns:
- a new ListenerSupport
-
-