net.sf.molae.pipe.genimpl
Class KeyProjection<E>
java.lang.Object
net.sf.molae.pipe.basic.ObjectProxy<B>
net.sf.molae.pipe.basic.CollectionProxy<B,E>
net.sf.molae.pipe.basic.SetProxy<Set<E>,E>
net.sf.molae.pipe.genimpl.KeyProjection<E>
- All Implemented Interfaces:
- Iterable<E>, Collection<E>, Set<E>
- Direct Known Subclasses:
- SortedKeyProjection
public class KeyProjection<E>
- extends SetProxy<Set<E>,E>
Implements a set on an arbitrary map by mapping each set element
to a map entry with the set element as key and a dummy element as value
of the map.
KeyProjection
public KeyProjection(Map<E,Object> base)
- Constructs a new key projection of the specified map.
- Parameters:
base - The base map of this set.
The map may contain entries, but must not contain null
values.
- Throws:
NullPointerException - if the specified object is
null.
size
public int size()
- Specified by:
size in interface Collection<E>- Specified by:
size in interface Set<E>- Overrides:
size in class CollectionProxy<Set<E>,E>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface Collection<E>- Specified by:
isEmpty in interface Set<E>- Overrides:
isEmpty in class CollectionProxy<Set<E>,E>
contains
public boolean contains(Object o)
- Specified by:
contains in interface Collection<E>- Specified by:
contains in interface Set<E>- Overrides:
contains in class CollectionProxy<Set<E>,E>
add
public boolean add(E o)
- Specified by:
add in interface Collection<E>- Specified by:
add in interface Set<E>- Overrides:
add in class CollectionProxy<Set<E>,E>
addAll
public boolean addAll(Collection<? extends E> c)
- Specified by:
addAll in interface Collection<E>- Specified by:
addAll in interface Set<E>- Overrides:
addAll in class CollectionProxy<Set<E>,E>
remove
public boolean remove(Object o)
- Removes the mapping with the specified object as key from the base map.
- Specified by:
remove in interface Collection<E>- Specified by:
remove in interface Set<E>- Overrides:
remove in class CollectionProxy<Set<E>,E>
- Throws:
UnsupportedOperationException - depending on the base map
clear
public void clear()
- Removes all of the elements from the base map.
- Specified by:
clear in interface Collection<E>- Specified by:
clear in interface Set<E>- Overrides:
clear in class CollectionProxy<Set<E>,E>
- Throws:
UnsupportedOperationException - depending on the base map