logahawk
Class AbstractContainer<T>
java.lang.Object
logahawk.AbstractContainer<T>
- Direct Known Subclasses:
- DefaultArgumentFormatterContainer, DefaultListenerContainer, DefaultSignatureFormatterContainer, MultiLogger
@ThreadSafe
public abstract class AbstractContainer<T>
- extends Object
An abstract base class to help implement the various container classes such as ArgumentFormatterContainer
,
SignatureFormatterContainer
, ListenerContainer
, etc.
This class is thread-safe (but the same guarantee is not made for the individual items).
Method Summary |
void |
add(T... c)
Adds the items in the order they provided. |
void |
addAll(Collection<T> c)
Adds the items in the order they provided. |
void |
clear()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
items
protected final CopyOnWriteArrayList<T> items
AbstractContainer
protected AbstractContainer()
AbstractContainer
protected AbstractContainer(Collection<T> c)
- Adds the provided items to this container. (The provided
Collection
is not used, a shallow copy is made.)
add
public void add(T... c)
- Adds the items in the order they provided. The items will be used (in the appropriate fashion) in the same order.
The default implementation of this method calls
addAll(Collection)
with a new Collection
created
from a call to Arrays.asList(Object[])
, so many implementations can simply override addAll(Collection)
.
addAll
public void addAll(Collection<T> c)
- Adds the items in the order they provided. The items will be used (in the appropriate fashion) in the same order.
clear
public void clear()