saker.util Documentation TaskDoc JavaDoc Packages
package saker.util
public abstract class SetTransformingNavigableMap<E, K, Vextends SetTransformingSortedMap<E, K, V> implements NavigableMap<K, V>
Pseudo-Map implementation that is backed by a set and dynamically generates the entries for it based on an element value.

Works exactly the same way as SetTransformingSortedMap, but also implements NavigableMap as well.

EThe element type of the set.
KThe key type of this map.
VThe value type of this map.
Constructors
public
SetTransformingNavigableMap(Set<extends E> set)
Creates a new instance with the given set.
public
SetTransformingNavigableMap(Set<extends E> set, Comparator<super K> comparator)
Creates a new instance with the given set and comparator.
Methods
public Entry<K, V>
Returns a key-value mapping associated with the least key greater than or equal to the given key, or null if there is no such key.
public K
ceilingKey(K key)
Returns the least key greater than or equal to the given key, or null if there is no such key.
public NavigableSet<K>
Returns a reverse order NavigableSet view of the keys contained in this map.
public NavigableMap<K, V>
Returns a reverse order view of the mappings contained in this map.
public Entry<K, V>
Returns a key-value mapping associated with the least key in this map, or null if the map is empty.
public K
Returns the first (lowest) key currently in this map.
public Entry<K, V>
floorEntry(K key)
Returns a key-value mapping associated with the greatest key less than or equal to the given key, or null if there is no such key.
public K
floorKey(K key)
Returns the greatest key less than or equal to the given key, or null if there is no such key.
public SortedMap<K, V>
headMap(K toKey)
Returns a view of the portion of this map whose keys are strictly less than toKey.
public NavigableMap<K, V>
headMap(K toKey, boolean inclusive)
Returns a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey.
public Entry<K, V>
Returns a key-value mapping associated with the least key strictly greater than the given key, or null if there is no such key.
public K
higherKey(K key)
Returns the least key strictly greater than the given key, or null if there is no such key.
public Entry<K, V>
Returns a key-value mapping associated with the greatest key in this map, or null if the map is empty.
public K
Returns the last (highest) key currently in this map.
public Entry<K, V>
lowerEntry(K key)
Returns a key-value mapping associated with the greatest key strictly less than the given key, or null if there is no such key.
public K
lowerKey(K key)
Returns the greatest key strictly less than the given key, or null if there is no such key.
public NavigableSet<K>
Returns a NavigableSet view of the keys contained in this map.
public Entry<K, V>
Removes and returns a key-value mapping associated with the least key in this map, or null if the map is empty.
public Entry<K, V>
Removes and returns a key-value mapping associated with the greatest key in this map, or null if the map is empty.
public SortedMap<K, V>
subMap(K fromKey, K toKey)
Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive.
public NavigableMap<K, V>
subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
Returns a view of the portion of this map whose keys range from fromKey to toKey.
public SortedMap<K, V>
tailMap(K fromKey)
Returns a view of the portion of this map whose keys are greater than or equal to fromKey.
public NavigableMap<K, V>
tailMap(K fromKey, boolean inclusive)
Returns a view of the portion of this map whose keys are greater than (or equal to, if inclusive is true) fromKey.
public SetTransformingNavigableMap(Set<extends E> set) throws NullPointerException
Creates a new instance with the given set.
setThe subject set.
NullPointerExceptionIf the set is null.
public SetTransformingNavigableMap(Set<extends E> set, Comparator<super K> comparator) throws NullPointerException
Creates a new instance with the given set and comparator.
setThe subject set.
comparatorThe comparator.
NullPointerExceptionIf the set is null.
public Entry<K, V> ceilingEntry(K key)
Overridden from: NavigableMap
Returns a key-value mapping associated with the least key greater than or equal to the given key, or null if there is no such key.
keythe key
an entry with the least key greater than or equal to key, or null if there is no such key
public K ceilingKey(K key)
Overridden from: NavigableMap
Returns the least key greater than or equal to the given key, or null if there is no such key.
keythe key
the least key greater than or equal to key, or null if there is no such key
Overridden from: NavigableMap
Returns a reverse order NavigableSet view of the keys contained in this map. The set's iterator returns the keys in descending order. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.
a reverse order navigable set view of the keys in this map
Overridden from: NavigableMap
Returns a reverse order view of the mappings contained in this map. The descending map is backed by this map, so changes to the map are reflected in the descending map, and vice-versa. If either map is modified while an iteration over a collection view of either map is in progress (except through the iterator's own remove operation), the results of the iteration are undefined.

The returned map has an ordering equivalent to Collections.reverseOrder(comparator()). The expression m.descendingMap().descendingMap() returns a view of m essentially equivalent to m.

a reverse order view of this map
public Entry<K, V> firstEntry()
Overridden from: NavigableMap
Returns a key-value mapping associated with the least key in this map, or null if the map is empty.
an entry with the least key, or null if this map is empty
public K firstKey()
Overridden from: SortedMap
Returns the first (lowest) key currently in this map.
the first (lowest) key currently in this map
public Entry<K, V> floorEntry(K key)
Overridden from: NavigableMap
Returns a key-value mapping associated with the greatest key less than or equal to the given key, or null if there is no such key.
keythe key
an entry with the greatest key less than or equal to key, or null if there is no such key
public K floorKey(K key)
Overridden from: NavigableMap
Returns the greatest key less than or equal to the given key, or null if there is no such key.
keythe key
the greatest key less than or equal to key, or null if there is no such key
public SortedMap<K, V> headMap(K toKey)
Overridden from: NavigableMap
Returns a view of the portion of this map whose keys are strictly less than toKey.The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

Equivalent to headMap(toKey, false).

a view of the portion of this map whose keys are strictly less than toKey
public NavigableMap<K, V> headMap(K toKey, boolean inclusive)
Overridden from: NavigableMap
Returns a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

toKeyhigh endpoint of the keys in the returned map
inclusivetrue if the high endpoint is to be included in the returned view
a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey
public Entry<K, V> higherEntry(K key)
Overridden from: NavigableMap
Returns a key-value mapping associated with the least key strictly greater than the given key, or null if there is no such key.
keythe key
an entry with the least key greater than key, or null if there is no such key
public K higherKey(K key)
Overridden from: NavigableMap
Returns the least key strictly greater than the given key, or null if there is no such key.
keythe key
the least key greater than key, or null if there is no such key
public Entry<K, V> lastEntry()
Overridden from: NavigableMap
Returns a key-value mapping associated with the greatest key in this map, or null if the map is empty.
an entry with the greatest key, or null if this map is empty
public K lastKey()
Overridden from: SortedMap
Returns the last (highest) key currently in this map.
the last (highest) key currently in this map
public Entry<K, V> lowerEntry(K key)
Overridden from: NavigableMap
Returns a key-value mapping associated with the greatest key strictly less than the given key, or null if there is no such key.
keythe key
an entry with the greatest key less than key, or null if there is no such key
public K lowerKey(K key)
Overridden from: NavigableMap
Returns the greatest key strictly less than the given key, or null if there is no such key.
keythe key
the greatest key less than key, or null if there is no such key
public Entry<K, V> pollFirstEntry()
Overridden from: NavigableMap
Removes and returns a key-value mapping associated with the least key in this map, or null if the map is empty.
the removed first entry of this map, or null if this map is empty
public Entry<K, V> pollLastEntry()
Overridden from: NavigableMap
Removes and returns a key-value mapping associated with the greatest key in this map, or null if the map is empty.
the removed last entry of this map, or null if this map is empty
public SortedMap<K, V> subMap(K fromKey, K toKey)
Overridden from: NavigableMap
Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive.(If fromKey and toKey are equal, the returned map is empty.) The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

Equivalent to subMap(fromKey, true, toKey, false).

a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive
public NavigableMap<K, V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
Overridden from: NavigableMap
Returns a view of the portion of this map whose keys range from fromKey to toKey. If fromKey and toKey are equal, the returned map is empty unless fromInclusive and toInclusive are both true. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside of its range, or to construct a submap either of whose endpoints lie outside its range.

fromKeylow endpoint of the keys in the returned map
fromInclusivetrue if the low endpoint is to be included in the returned view
toKeyhigh endpoint of the keys in the returned map
toInclusivetrue if the high endpoint is to be included in the returned view
a view of the portion of this map whose keys range from fromKey to toKey
public SortedMap<K, V> tailMap(K fromKey)
Overridden from: NavigableMap
Returns a view of the portion of this map whose keys are greater than or equal to fromKey.The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

Equivalent to tailMap(fromKey, true).

a view of the portion of this map whose keys are greater than or equal to fromKey
public NavigableMap<K, V> tailMap(K fromKey, boolean inclusive)
Overridden from: NavigableMap
Returns a view of the portion of this map whose keys are greater than (or equal to, if inclusive is true) fromKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

fromKeylow endpoint of the keys in the returned map
inclusivetrue if the low endpoint is to be included in the returned view
a view of the portion of this map whose keys are greater than (or equal to, if inclusive is true) fromKey