util
Class DummySet<E>

java.lang.Object
  extended by util.DummySet<E>
Type Parameters:
E -
All Implemented Interfaces:
java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>

public final class DummySet<E>
extends java.lang.Object
implements java.util.Set<E>

The DummySet can be used to remove the space consuming behavior and retain the checking behavior of a set.
It will accept all elements of Type E but will never store anything. Every return value is fixed to a default value:

Author:
eden06

Constructor Summary
DummySet()
          Creates a new DummySet instance.
 
Method Summary
 boolean add(E e)
          This Method does not store anything but will return true for each e.
 boolean addAll(java.util.Collection<? extends E> c)
          This Method does not store anything but will return true for each Collection c.
 void clear()
          This Method does nothing.
 boolean contains(java.lang.Object o)
          This Method does not check anything but will return false for each Object o.
 boolean containsAll(java.util.Collection<?> c)
          This Method does not check anything but will return true for each Collection c.
 boolean isEmpty()
          This Method will always return false because the set is always empty.
 java.util.Iterator<E> iterator()
          This Method will always return an empty iterator because the set is always empty.
 boolean remove(java.lang.Object o)
          This Method does not remove anything but will return true for each Object o.
 boolean removeAll(java.util.Collection<?> c)
          This Method does not remove anything but will return true for each Object o.
 boolean retainAll(java.util.Collection<?> c)
          This Method does not retain anything but will return true for each Collection c.
 int size()
          This Method will always return 0 because the set is always empty.
 java.lang.Object[] toArray()
          This Method will always return an empty array.
<T> T[]
toArray(T[] a)
          This Method will always return null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Set
equals, hashCode
 

Constructor Detail

DummySet

public DummySet()
Creates a new DummySet instance.

Method Detail

add

public final boolean add(E e)
This Method does not store anything but will return true for each e.

Specified by:
add in interface java.util.Collection<E>
Specified by:
add in interface java.util.Set<E>
See Also:
Set.add(java.lang.Object)

addAll

public final boolean addAll(java.util.Collection<? extends E> c)
This Method does not store anything but will return true for each Collection c.

Specified by:
addAll in interface java.util.Collection<E>
Specified by:
addAll in interface java.util.Set<E>
See Also:
Set.addAll(java.util.Collection)

clear

public final void clear()
This Method does nothing.

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

contains

public final boolean contains(java.lang.Object o)
This Method does not check anything but will return false for each Object o.

Specified by:
contains in interface java.util.Collection<E>
Specified by:
contains in interface java.util.Set<E>
See Also:
Set.contains(java.lang.Object)

containsAll

public final boolean containsAll(java.util.Collection<?> c)
This Method does not check anything but will return true for each Collection c.

Specified by:
containsAll in interface java.util.Collection<E>
Specified by:
containsAll in interface java.util.Set<E>
See Also:
Set.containsAll(java.util.Collection)

isEmpty

public final boolean isEmpty()
This Method will always return false because the set is always empty.

Specified by:
isEmpty in interface java.util.Collection<E>
Specified by:
isEmpty in interface java.util.Set<E>
See Also:
Set.isEmpty()

iterator

public final java.util.Iterator<E> iterator()
This Method will always return an empty iterator because the set is always empty.

Specified by:
iterator in interface java.lang.Iterable<E>
Specified by:
iterator in interface java.util.Collection<E>
Specified by:
iterator in interface java.util.Set<E>
See Also:
Set.iterator()

remove

public final boolean remove(java.lang.Object o)
This Method does not remove anything but will return true for each Object o.

Specified by:
remove in interface java.util.Collection<E>
Specified by:
remove in interface java.util.Set<E>
See Also:
Set.remove(java.lang.Object)

removeAll

public final boolean removeAll(java.util.Collection<?> c)
This Method does not remove anything but will return true for each Object o.

Specified by:
removeAll in interface java.util.Collection<E>
Specified by:
removeAll in interface java.util.Set<E>
See Also:
Set.removeAll(java.util.Collection)

retainAll

public final boolean retainAll(java.util.Collection<?> c)
This Method does not retain anything but will return true for each Collection c.

Specified by:
retainAll in interface java.util.Collection<E>
Specified by:
retainAll in interface java.util.Set<E>
See Also:
Set.retainAll(java.util.Collection)

size

public final int size()
This Method will always return 0 because the set is always empty.

Specified by:
size in interface java.util.Collection<E>
Specified by:
size in interface java.util.Set<E>
See Also:
Set.size()

toArray

public final java.lang.Object[] toArray()
This Method will always return an empty array.

Specified by:
toArray in interface java.util.Collection<E>
Specified by:
toArray in interface java.util.Set<E>
See Also:
Set.toArray()

toArray

public final <T> T[] toArray(T[] a)
This Method will always return null.

Specified by:
toArray in interface java.util.Collection<E>
Specified by:
toArray in interface java.util.Set<E>
See Also:
Set.toArray(java.lang.Object[])