org.omnaest.utils.structure.collection.decorator
Class CollectionDecorator<E>

java.lang.Object
  extended by org.omnaest.utils.structure.collection.decorator.CollectionDecorator<E>
Type Parameters:
E -
All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>
Direct Known Subclasses:
LockingCollectionDecorator

public class CollectionDecorator<E>
extends Object
implements Collection<E>, Serializable

The CollectionDecorator is intended to decorate an existing Collection instance. If it is subclassed method calls to the decorator can be intercepted before they are invoked for the underlying Collection.

Author:
Omnaest
See Also:
Serialized Form

Field Summary
protected  Collection<E> collection
           
 
Constructor Summary
protected CollectionDecorator()
           
  CollectionDecorator(Collection<E> collection)
           
 
Method Summary
 boolean add(E e)
           
 boolean addAll(Collection<? extends E> c)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> c)
           
 boolean equals(Object o)
           
protected  Collection<E> getCollection()
           
 int hashCode()
           
 boolean isEmpty()
           
 Iterator<E> iterator()
           
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> c)
           
 boolean retainAll(Collection<?> c)
           
protected  void setCollection(Collection<E> collection)
           
 int size()
           
 Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

collection

protected Collection<E> collection
Constructor Detail

CollectionDecorator

public CollectionDecorator(Collection<E> collection)
Parameters:
collection -
See Also:
CollectionDecorator

CollectionDecorator

protected CollectionDecorator()
See Also:
CollectionDecorator
Method Detail

size

public int size()
Specified by:
size in interface Collection<E>
Returns:
See Also:
Collection.size()

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<E>
Returns:
See Also:
Collection.isEmpty()

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<E>
Parameters:
o -
Returns:
See Also:
Collection.contains(java.lang.Object)

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Returns:
See Also:
Collection.iterator()

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<E>
Returns:
See Also:
Collection.toArray()

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface Collection<E>
Parameters:
a -
Returns:
See Also:
java.util.Collection#toArray(T[])

add

public boolean add(E e)
Specified by:
add in interface Collection<E>
Parameters:
e -
Returns:
See Also:
Collection.add(java.lang.Object)

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<E>
Parameters:
o -
Returns:
See Also:
Collection.remove(java.lang.Object)

containsAll

public boolean containsAll(Collection<?> c)
Specified by:
containsAll in interface Collection<E>
Parameters:
c -
Returns:
See Also:
Collection.containsAll(java.util.Collection)

addAll

public boolean addAll(Collection<? extends E> c)
Specified by:
addAll in interface Collection<E>
Parameters:
c -
Returns:
See Also:
Collection.addAll(java.util.Collection)

removeAll

public boolean removeAll(Collection<?> c)
Specified by:
removeAll in interface Collection<E>
Parameters:
c -
Returns:
See Also:
Collection.removeAll(java.util.Collection)

retainAll

public boolean retainAll(Collection<?> c)
Specified by:
retainAll in interface Collection<E>
Parameters:
c -
Returns:
See Also:
Collection.retainAll(java.util.Collection)

clear

public void clear()
Specified by:
clear in interface Collection<E>
See Also:
Collection.clear()

equals

public boolean equals(Object o)
Specified by:
equals in interface Collection<E>
Overrides:
equals in class Object
Parameters:
o -
Returns:
See Also:
Collection.equals(java.lang.Object)

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection<E>
Overrides:
hashCode in class Object
Returns:
See Also:
Collection.hashCode()

getCollection

protected Collection<E> getCollection()
Returns:
the collection

setCollection

protected void setCollection(Collection<E> collection)
Parameters:
collection - the collection to set

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.