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) 2016-2019 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
ImmutableMap.ImmutableEntry<K,V>
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, entrySet, 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
- K; 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
- K; 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
- K; 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
- K; 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
- K; low endpoint of the returned immutable mapfromInclusive
- boolean; true
if the low endpoint is to be included in the returned viewtoKey
- K; high endpoint of the returned immutable maptoInclusive
- boolean; 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
- K; high endpoint of the returned immutable mapinclusive
- boolean; 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
- K; low endpoint of the returned immutable mapinclusive
- boolean; 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
- Object; 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 © 2018–2019 Delft University of Technology. All rights reserved.