public abstract class

AbstractCollectionDecorator

extends Object
implements Collection<E>
java.lang.Object
   ↳ org.apache.commons.collections.collection.AbstractCollectionDecorator
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Decorates another Collection to provide additional behaviour.

Each method call made on this Collection is forwarded to the decorated Collection. 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 of Collection, 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.

Summary

Fields
protected Collection collection The collection being decorated
Protected Constructors
AbstractCollectionDecorator()
Constructor only used in deserialization, do not use otherwise.
AbstractCollectionDecorator(Collection coll)
Constructor that wraps (not copies).
Public Methods
boolean add(Object object)
boolean addAll(Collection coll)
void clear()
boolean contains(Object object)
boolean containsAll(Collection coll)
boolean equals(Object object)
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 Methods
Collection getCollection()
Gets the collection being decorated.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.lang.Iterable
From interface java.util.Collection

Fields

protected Collection collection

The collection being decorated

Protected Constructors

protected AbstractCollectionDecorator ()

Constructor only used in deserialization, do not use otherwise.

protected AbstractCollectionDecorator (Collection coll)

Constructor that wraps (not copies).

Parameters
coll the collection to decorate, must not be null
Throws
IllegalArgumentException if the collection is null

Public Methods

public 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)

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 ()

Protected Methods

protected Collection getCollection ()

Gets the collection being decorated.

Returns
  • the decorated collection