saker.util Documentation TaskDoc JavaDoc Packages
package saker.util
public abstract class TransformingNavigableMap<MK, MV, K, Vextends TransformingSortedMap<MK, MV, K, V> implements NavigableMap<K, V>
Pseudo-Map implementation that dynamically generates the entries for it based on the entries of a subject map.

Works exactly the same way as TransformingSortedMap, but also implements NavigableSet as well.

MKThe key type of the source map.
MVThe value type of the source map.
KThe key type of this map.
VThe value type of this map.
Constructors
public
TransformingNavigableMap(Map<extends MK, ? extends MV> map)
Creates a new instance with the given map.
public
TransformingNavigableMap(Map<extends MK, ? extends MV> map, Comparator<super K> comparator)
Creates a new instance with the given map 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 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 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 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 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 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 TransformingNavigableMap(Map<extends MK, ? extends MV> map) throws NullPointerException
Creates a new instance with the given map.
mapThe subject map.
NullPointerExceptionIf the map is null.
public TransformingNavigableMap(Map<extends MK, ? extends MV> map, Comparator<super K> comparator) throws NullPointerException
Creates a new instance with the given map and comparator.
mapThe subject map.
comparatorThe comparator.
NullPointerExceptionIf the map 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 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 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 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 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 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