net.sf.molae.pipe.genimpl
Class SortedKeyProjection<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>
net.sf.molae.pipe.genimpl.SortedKeyProjection<E>
- All Implemented Interfaces:
- Iterable<E>, Collection<E>, Set<E>, SortedSet<E>
public final class SortedKeyProjection<E>
- extends KeyProjection<E>
- implements SortedSet<E>
Implements a sorted set on an arbitrary sorted 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.
Methods inherited from interface java.util.Set |
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
SortedKeyProjection
public SortedKeyProjection(SortedMap<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.
comparator
public Comparator<? super E> comparator()
- Specified by:
comparator
in interface SortedSet<E>
subSet
public SortedSet<E> subSet(E fromElement,
E toElement)
- Specified by:
subSet
in interface SortedSet<E>
- Throws:
ClassCastException
- depending on the base map
IllegalArgumentException
- depending on the base map
NullPointerException
- depending on the base map
headSet
public SortedSet<E> headSet(E toElement)
- Specified by:
headSet
in interface SortedSet<E>
- Throws:
ClassCastException
- depending on the base map
IllegalArgumentException
- depending on the base map
NullPointerException
- depending on the base map
tailSet
public SortedSet<E> tailSet(E fromElement)
- Specified by:
tailSet
in interface SortedSet<E>
- Throws:
ClassCastException
- depending on the base map
IllegalArgumentException
- depending on the base map
NullPointerException
- depending on the base map
first
public E first()
- Returns the first (lowest) key currently in the base map.
- Specified by:
first
in interface SortedSet<E>
- Returns:
- the first (lowest) key currently in the base map.
- Throws:
NoSuchElementException
- base map is empty.
last
public E last()
- Returns the last (highest) key currently in the base map.
- Specified by:
last
in interface SortedSet<E>
- Returns:
- the last (highest) key currently in the base map.
- Throws:
NoSuchElementException
- base map is empty.