K
- the key type of content of this MapV
- the value type of content of this Mappublic interface ImmutableNavigableMap<K,V> extends ImmutableSortedMap<K,V>
ImmutableSortedMap
extended with navigation methods reporting closest matches for given search targets. Methods
lowerKey
, floorKey
, ceilingKey
, and higherKey
return keys respectively less than, less than
or equal, greater than or equal, and greater than a given key, returning null
if there is no such key. All methods
from java.util.NavigableMap that can change the map have been left out.
Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Method and Description |
---|---|
K |
ceilingKey(K e)
Returns the least key in this immutable map greater than or equal to the given key, or
null if there is no such
key. |
ImmutableNavigableMap<K,V> |
descendingMap()
Returns a reverse order view of the keys contained in this immutable map.
|
boolean |
equals(Object obj)
Force to redefine equals for the implementations of immutable collection classes.
|
K |
floorKey(K e)
Returns the greatest key in this immutable map less than or equal to the given key, or
null if there is no such
key. |
int |
hashCode()
Force to redefine hashCode for the implementations of immutable collection classes.
|
ImmutableNavigableMap<K,V> |
headMap(K toKey,
boolean inclusive)
Returns a view of the portion of this immutable map whose keys are less than (or equal to, if
inclusive is true)
toKey . |
K |
higherKey(K e)
Returns the least key in this immutable map strictly greater than the given key, or
null if there is no such key. |
ImmutableSortedSet<K> |
keySet()
Returns a
ImmutableSortedSet view of the keys contained in this map. |
K |
lowerKey(K e)
Returns the greatest key in this immutable map strictly less than the given key, or
null if there is no such key. |
ImmutableNavigableMap<K,V> |
subMap(K fromKey,
boolean fromInclusive,
K toKey,
boolean toInclusive)
Returns a view of the portion of this immutable map whose keys range from
fromKey to toKey . |
ImmutableNavigableMap<K,V> |
tailMap(K fromKey,
boolean inclusive)
Returns a view of the portion of this immutable map whose keys are greater than (or equal to, if
inclusive is
true) fromKey . |
NavigableMap<K,V> |
toMap()
Returns a modifiable copy of this immutable map.
|
comparator, firstKey, headMap, lastKey, subMap, tailMap
containsKey, containsValue, forEach, get, getOrDefault, isCopy, isEmpty, isWrap, size, values
NavigableMap<K,V> toMap()
toMap
in interface ImmutableMap<K,V>
toMap
in interface ImmutableSortedMap<K,V>
ImmutableSortedSet<K> keySet()
ImmutableSortedSet
view of the keys contained in this map.keySet
in interface ImmutableMap<K,V>
keySet
in interface ImmutableSortedMap<K,V>
K lowerKey(K e)
null
if there is no such key.e
- the value to matche
, or null
if there is no such keyClassCastException
- if the specified key cannot be compared with the keys currently in the immutable mapNullPointerException
- if the specified key is null and this immutable map does not permit null keysK floorKey(K e)
null
if there is no such
key.e
- the value to matche
, or null
if there is no such keyClassCastException
- if the specified key cannot be compared with the keys currently in the immutable mapNullPointerException
- if the specified key is null and this immutable map does not permit null keysK ceilingKey(K e)
null
if there is no such
key.e
- the value to matche
, or null
if there is no such keyClassCastException
- if the specified key cannot be compared with the keys currently in the immutable mapNullPointerException
- if the specified key is null and this immutable map does not permit null keysK higherKey(K e)
null
if there is no such key.e
- the value to matche
, or null
if there is no such keyClassCastException
- if the specified key cannot be compared with the keys currently in the immutable mapNullPointerException
- if the specified key is null and this immutable map does not permit null keysImmutableNavigableMap<K,V> descendingMap()
The returned immutable map has an ordering equivalent to
Collections.reverseOrder
(comparator()). The expression
s.descendingMap().descendingMap()
returns a view of s
essentially equivalent to s
.
ImmutableNavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
fromKey
to toKey
. If
fromKey
and toKey
are equal, the returned immutable map is empty unless fromInclusive
and
toInclusive
are both true.fromKey
- low endpoint of the returned immutable mapfromInclusive
- true
if the low endpoint is to be included in the returned viewtoKey
- high endpoint of the returned immutable maptoInclusive
- true
if the high endpoint is to be included in the returned viewfromKey
, inclusive, to toKey
,
exclusiveClassCastException
- if fromKey
and toKey
cannot be compared to one another using this immutable
map's comparator (or, if the immutable map has no comparator, using natural ordering). Implementations may,
but are not required to, throw this exception if fromKey
or toKey
cannot be compared to keys
currently in the immutable map.NullPointerException
- if fromKey
or toKey
is null and this immutable map does not permit null keysIllegalArgumentException
- if fromKey
is greater than toKey
; or if this immutable map itself has a
restricted range, and fromKey
or toKey
lies outside the bounds of the range.ImmutableNavigableMap<K,V> headMap(K toKey, boolean inclusive)
inclusive
is true)
toKey
.toKey
- high endpoint of the returned immutable mapinclusive
- true
if the high endpoint is to be included in the returned viewinclusive
is true)
toKey
ClassCastException
- if toKey
is not compatible with this immutable map's comparator (or, if the immutable
map has no comparator, if toKey
does not implement Comparable
). Implementations may, but are
not required to, throw this exception if toKey
cannot be compared to keys currently in the immutable
map.NullPointerException
- if toKey
is null and this immutable map does not permit null keysIllegalArgumentException
- if this immutable map itself has a restricted range, and toKey
lies outside the
bounds of the rangeImmutableNavigableMap<K,V> tailMap(K fromKey, boolean inclusive)
inclusive
is
true) fromKey
.fromKey
- low endpoint of the returned immutable mapinclusive
- true
if the low endpoint is to be included in the returned viewfromKey
ClassCastException
- if fromKey
is not compatible with this immutable map's comparator (or, if the
immutable map has no comparator, if fromKey
does not implement Comparable
). Implementations
may, but are not required to, throw this exception if fromKey
cannot be compared to keys currently in
the immutable map.NullPointerException
- if fromKey
is null and this immutable map does not permit null keysIllegalArgumentException
- if this immutable map itself has a restricted range, and fromKey
lies outside
the bounds of the rangeboolean equals(Object obj)
equals
in interface ImmutableMap<K,V>
equals
in interface ImmutableSortedMap<K,V>
equals
in class Object
obj
- the object to compare this collection withint hashCode()
hashCode
in interface ImmutableMap<K,V>
hashCode
in interface ImmutableSortedMap<K,V>
hashCode
in class Object
Copyright © 2014–2016 Delft University of Technology. All rights reserved.