org.omnaest.utils.structure.collection.set.decorator
Class SetDecorator<E>

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

public class SetDecorator<E>
extends Object
implements Set<E>, Serializable

A SetDecorator decorates an existing Set instance. If it is subclassed method invocations can be intercepted by overriding methods partially.

Author:
Omnaest
See Also:
Serialized Form

Field Summary
protected  Set<E> set
           
 
Constructor Summary
protected SetDecorator()
           
  SetDecorator(Set<E> set)
           
 
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  Set<E> getSet()
           
 int hashCode()
           
 boolean isEmpty()
           
 Iterator<E> iterator()
           
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> c)
           
 boolean retainAll(Collection<?> c)
           
protected  void setSet(Set<E> set)
           
 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

set

protected Set<E> set
Constructor Detail

SetDecorator

public SetDecorator(Set<E> set)
Parameters:
set -
See Also:
SetDecorator

SetDecorator

protected SetDecorator()
See Also:
SetDecorator
Method Detail

size

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

isEmpty

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

contains

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

iterator

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

toArray

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

toArray

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

add

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

remove

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

containsAll

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

addAll

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

retainAll

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

removeAll

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

clear

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

equals

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

hashCode

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

getSet

protected Set<E> getSet()
Returns:
the set

setSet

protected void setSet(Set<E> set)
Parameters:
set - the set to set

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.