java.lang.Object | +--org.apache.commons.collections.collection.AbstractCollectionDecoratorAll Implemented Interfaces:
Collection | The collection being decorated |
AbstractCollectionDecorator(Collection coll) Constructor that wraps (not copies). |
boolean | add(Object object) |
boolean | addAll(Collection coll) |
void | clear() |
boolean | contains(Object object) |
boolean | containsAll(Collection coll) |
boolean | equals(Object object) |
Collection | Gets the collection being decorated. |
int | hashCode() |
boolean | isEmpty() |
Iterator | iterator() |
boolean | remove(Object object) |
boolean | removeAll(Collection coll) |
boolean | retainAll(Collection coll) |
int | size() |
Object[] | toArray() |
Object[] | toArray(Object[] object) |
String | toString() |
protected final Collection collection
protected AbstractCollectionDecorator(Collection coll)
- if the collection is nullpublic boolean add(Object object)
public boolean addAll(Collection coll)
public void clear()
public boolean contains(Object object)
public boolean containsAll(Collection coll)
public boolean equals(Object object)
protected Collection getCollection()
public int hashCode()
public boolean isEmpty()
public Iterator iterator()
public boolean remove(Object object)
public boolean removeAll(Collection coll)
public boolean retainAll(Collection coll)
public int size()
public Object[] toArray()
public Object[] toArray(Object[] object)
public String toString()
Collection
to provide additional behaviour. Each method call made on thisCollection
is forwarded to the decoratedCollection
. This class is used as a framework on which to build to extensions such as synchronized and unmodifiable behaviour. The main advantage of decoration is that one decorator can wrap any implementation ofCollection
, whereas sub-classing requires a new class to be written for each implementation. This implementation does not perform any special processing with iterator(). Instead it simply returns the value from the wrapped collection. This may be undesirable, for example if you are trying to write an unmodifiable implementation it might provide a loophole.