Package Torello.Java.ReadOnly
Interface ReadOnlyNavigableMap<K,V>
-
- Type Parameters:
K
- the type of keys maintained by this mapV
- the type of mapped values
- All Superinterfaces:
ReadOnlyMap<K,V>
,ReadOnlySequencedMap<K,V>
,ReadOnlySortedMap<K,V>
- All Known Implementing Classes:
ReadOnlyTreeMap
public interface ReadOnlyNavigableMap<K,V> extends ReadOnlySortedMap<K,V>
This interface was originally copied fromGitHub's Open-JDK
Account. Though the original file has been modified, few changes have been applied to the Javadoc Commenting. Due to fact that that is a Javainterface
file, there were few method bodies with Source-Code to begin with - meaning this is largely a copy of Method-Signatures and Java-Doc Comments.
Method and parameter names & types have not been modified whatsoever; but several methods had to be eliminated for not being Read-Only. This Source-File was copied from the original Open JDK-21 file of the same (or, rather, highly similar) Interface-Name. The original file may be viewed on theJDK-21 GitHub
public (and, coincidentally, Read-Only) Source-Release archive for Java Packagejava.util.*
The Original'.java'
Source-File's Header-Copyright Information is included here:File Copyright
. Within that Copyright Notice, it is suggested that a copy of theGNU Public License V2
also be included alongside.Immutable variant of Java Collectionds Framework interfacejava.util.NavigableMap<K, V>
. This interface contains all of the methods that the standard Java interface ReadOnlyNavigableMap contains - except those which would directly or indirectly modify / mutate the internal data-structure.
Hi-Lited Source-Code:- View Here: Torello/Java/ReadOnly/ReadOnlyNavigableMap.java
- Open New Browser-Tab: Torello/Java/ReadOnly/ReadOnlyNavigableMap.java
File Size: 14,277 Bytes Line Count: 359 '\n' Characters Found
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface Torello.Java.ReadOnly.ReadOnlyMap
ReadOnlyMap.Entry<K,V>
-
-
Method Summary
Retrieve the Least Map Key Modifier and Type Method K
floorKey(K key)
K
lowerKey(K key)
Retrieve the Greatest Map Key Modifier and Type Method K
ceilingKey(K key)
K
higherKey(K key)
Retrieve the Least Key-Value Pair Modifier and Type Method ReadOnlyMap.Entry<K,V>
ceilingEntry(K key)
ReadOnlyMap.Entry<K,V>
higherEntry(K key)
ReadOnlyMap.Entry<K,V>
lastEntry()
Retrieve the Greatest Key-Value Pair Modifier and Type Method ReadOnlyMap.Entry<K,V>
firstEntry()
ReadOnlyMap.Entry<K,V>
floorEntry(K key)
ReadOnlyMap.Entry<K,V>
lowerEntry(K key)
Retrieve a Sub-Map as a ReadOnlyNavigableMap Modifier and Type Method ReadOnlyNavigableMap<K,V>
headMap(K toKey, boolean inclusive)
ReadOnlyNavigableMap<K,V>
subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
ReadOnlyNavigableMap<K,V>
tailMap(K fromKey, boolean inclusive)
Retrieve a Sub-Map as a ReadOnlySortedMap Modifier and Type Method ReadOnlySortedMap<K,V>
headMap(K toKey)
ReadOnlySortedMap<K,V>
subMap(K fromKey, K toKey)
ReadOnlySortedMap<K,V>
tailMap(K fromKey)
Retrieve a Reverse-Ordered Map Modifier and Type Method ReadOnlyNavigableMap<K,V>
descendingMap()
Retrieve a Set of Map Keys Modifier and Type Method ReadOnlyNavigableSet<K>
descendingKeySet()
ReadOnlyNavigableSet<K>
navigableKeySet()
Default Methods (Interface Methods with a Concrete, Default Implementation) Modifier and Type Method default ReadOnlyNavigableMap<K,V>
reversed()
-
Methods inherited from interface Torello.Java.ReadOnly.ReadOnlyMap
containsKey, containsKeyAND, containsKeyAND, containsKeyNAND, containsKeyNAND, containsKeyOR, containsKeyOR, containsKeyXOR, containsKeyXOR, containsValue, containsValueAND, containsValueAND, containsValueNAND, containsValueNAND, containsValueOR, containsValueOR, containsValueXOR, containsValueXOR, copyIntoMap, equals, forEach, get, getOrDefault, hashCode, isEmpty, size
-
Methods inherited from interface Torello.Java.ReadOnly.ReadOnlySequencedMap
sequencedEntrySet, sequencedKeySet, sequencedValues
-
Methods inherited from interface Torello.Java.ReadOnly.ReadOnlySortedMap
comparator, entrySet, firstKey, keySet, lastKey, values
-
-
-
-
Method Detail
-
lowerEntry
ReadOnlyMap.Entry<K,V> lowerEntry(K key)
Returns a key-value mapping associated with the greatest key strictly less than the given key, ornull
if there is no such key.- Parameters:
key
- the key- Returns:
- an entry with the greatest key less than
key
, ornull
if there is no such key - Throws:
java.lang.ClassCastException
- if the specified key cannot be compared with the keys currently in the mapjava.lang.NullPointerException
- if the specified key is null and this map does not permit null keys
-
lowerKey
K lowerKey(K key)
Returns the greatest key strictly less than the given key, ornull
if there is no such key.- Parameters:
key
- the key- Returns:
- the greatest key less than
key
, ornull
if there is no such key - Throws:
java.lang.ClassCastException
- if the specified key cannot be compared with the keys currently in the mapjava.lang.NullPointerException
- if the specified key is null and this map does not permit null keys
-
floorEntry
ReadOnlyMap.Entry<K,V> floorEntry(K key)
Returns a key-value mapping associated with the greatest key less than or equal to the given key, ornull
if there is no such key.- Parameters:
key
- the key- Returns:
- an entry with the greatest key less than or equal to
key
, ornull
if there is no such key - Throws:
java.lang.ClassCastException
- if the specified key cannot be compared with the keys currently in the mapjava.lang.NullPointerException
- if the specified key is null and this map does not permit null keys
-
floorKey
K floorKey(K key)
Returns the greatest key less than or equal to the given key, ornull
if there is no such key.- Parameters:
key
- the key- Returns:
- the greatest key less than or equal to
key
, ornull
if there is no such key - Throws:
java.lang.ClassCastException
- if the specified key cannot be compared with the keys currently in the mapjava.lang.NullPointerException
- if the specified key is null and this map does not permit null keys
-
ceilingEntry
ReadOnlyMap.Entry<K,V> ceilingEntry(K key)
Returns a key-value mapping associated with the least key greater than or equal to the given key, ornull
if there is no such key.- Parameters:
key
- the key- Returns:
- an entry with the least key greater than or equal to
key
, ornull
if there is no such key - Throws:
java.lang.ClassCastException
- if the specified key cannot be compared with the keys currently in the mapjava.lang.NullPointerException
- if the specified key is null and this map does not permit null keys
-
ceilingKey
K ceilingKey(K key)
Returns the least key greater than or equal to the given key, ornull
if there is no such key.- Parameters:
key
- the key- Returns:
- the least key greater than or equal to
key
, ornull
if there is no such key - Throws:
java.lang.ClassCastException
- if the specified key cannot be compared with the keys currently in the mapjava.lang.NullPointerException
- if the specified key is null and this map does not permit null keys
-
higherEntry
ReadOnlyMap.Entry<K,V> higherEntry(K key)
Returns a key-value mapping associated with the least key strictly greater than the given key, ornull
if there is no such key.- Parameters:
key
- the key- Returns:
- an entry with the least key greater than
key
, ornull
if there is no such key - Throws:
java.lang.ClassCastException
- if the specified key cannot be compared with the keys currently in the mapjava.lang.NullPointerException
- if the specified key is null and this map does not permit null keys
-
higherKey
K higherKey(K key)
Returns the least key strictly greater than the given key, ornull
if there is no such key.- Parameters:
key
- the key- Returns:
- the least key greater than
key
, ornull
if there is no such key - Throws:
java.lang.ClassCastException
- if the specified key cannot be compared with the keys currently in the mapjava.lang.NullPointerException
- if the specified key is null and this map does not permit null keys
-
firstEntry
ReadOnlyMap.Entry<K,V> firstEntry()
Returns a key-value mapping associated with the least key in this map, ornull
if the map is empty.- Specified by:
firstEntry
in interfaceReadOnlySequencedMap<K,V>
- Returns:
- an entry with the least key, or
null
if this map is empty
-
lastEntry
ReadOnlyMap.Entry<K,V> lastEntry()
Returns a key-value mapping associated with the greatest key in this map, ornull
if the map is empty.- Specified by:
lastEntry
in interfaceReadOnlySequencedMap<K,V>
- Returns:
- an entry with the greatest key, or
null
if this map is empty
-
descendingMap
ReadOnlyNavigableMap<K,V> descendingMap()
Returns a reverse order view of the mappings contained in this map.- Returns:
- a reverse order view of this map
-
navigableKeySet
ReadOnlyNavigableSet<K> navigableKeySet()
Returns aReadOnlyNavigableSet
view of the keys contained in this map. The set's iterator returns the keys in ascending order.- Returns:
- a navigable set view of the keys in this map
-
descendingKeySet
ReadOnlyNavigableSet<K> descendingKeySet()
Returns a reverse orderReadOnlyNavigableSet
view of the keys contained in this map. The set's iterator returns the keys in descending order.- Returns:
- a reverse order navigable set view of the keys in this map
-
subMap
ReadOnlyNavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
Returns a view of the portion of this map whose keys range fromfromKey
totoKey
. IffromKey
andtoKey
are equal, the returned map is empty unlessfromInclusive
andtoInclusive
are both true.
The returned map supports all optional map operations that this map supports.- Parameters:
fromKey
- low endpoint of the keys in the returned mapfromInclusive
-TRUE
if the low endpoint is to be included in the returned viewtoKey
- high endpoint of the keys in the returned maptoInclusive
-TRUE
if the high endpoint is to be included in the returned view- Returns:
- a view of the portion of this map whose keys range from
fromKey
totoKey
- Throws:
java.lang.ClassCastException
- iffromKey
andtoKey
cannot be compared to one another using this map's comparator (or, if the map has no comparator, using natural ordering). Implementations may, but are not required to, throw this exception iffromKey
ortoKey
cannot be compared to keys currently in the map.java.lang.NullPointerException
- iffromKey
ortoKey
is null and this map does not permit null keysjava.lang.IllegalArgumentException
- iffromKey
is greater thantoKey
; or if this map itself has a restricted range, andfromKey
ortoKey
lies outside the bounds of the range
-
headMap
ReadOnlyNavigableMap<K,V> headMap(K toKey, boolean inclusive)
Returns a view of the portion of this map whose keys are less than (or equal to, ifinclusive
is true)toKey
. The returned map supports all optional map operations that this map supports.- Parameters:
toKey
- high endpoint of the keys in the returned mapinclusive
-TRUE
if the high endpoint is to be included in the returned view- Returns:
- a view of the portion of this map whose keys are less than (or equal to, if
inclusive
is true)toKey
- Throws:
java.lang.ClassCastException
- iftoKey
is not compatible with this map's comparator (or, if the map has no comparator, iftoKey
does not implementComparable
). Implementations may, but are not required to, throw this exception iftoKey
cannot be compared to keys currently in the map.java.lang.NullPointerException
- iftoKey
is null and this map does not permit null keysjava.lang.IllegalArgumentException
- if this map itself has a restricted range, andtoKey
lies outside the bounds of the range
-
tailMap
ReadOnlyNavigableMap<K,V> tailMap(K fromKey, boolean inclusive)
Returns a view of the portion of this map whose keys are greater than (or equal to, ifinclusive
is true)fromKey
. The returned map supports all optional map operations that this map supports.- Parameters:
fromKey
- low endpoint of the keys in the returned mapinclusive
-TRUE
if the low endpoint is to be included in the returned view- Returns:
- a view of the portion of this map whose keys are greater than (or equal to, if
inclusive
is true)fromKey
- Throws:
java.lang.ClassCastException
- iffromKey
is not compatible with this map's comparator (or, if the map has no comparator, iffromKey
does not implementComparable
). Implementations may, but are not required to, throw this exception iffromKey
cannot be compared to keys currently in the map.java.lang.NullPointerException
- iffromKey
is null and this map does not permit null keysjava.lang.IllegalArgumentException
- if this map itself has a restricted range, andfromKey
lies outside the bounds of the range
-
subMap
ReadOnlySortedMap<K,V> subMap(K fromKey, K toKey)
Returns a view of the portion of this map whose keys range fromfromKey
, inclusive, totoKey
, exclusive. (IffromKey
andtoKey
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 anIllegalArgumentException
on an attempt to insert a key outside its range.
Equivalent tosubMap(fromKey, true, toKey, false)
.- Specified by:
subMap
in interfaceReadOnlySortedMap<K,V>
- Parameters:
fromKey
- low endpoint (inclusive) of the keys in the returned maptoKey
- high endpoint (exclusive) of the keys in the returned map- Returns:
- a view of the portion of this map whose keys range from
fromKey
, inclusive, totoKey
, exclusive - Throws:
java.lang.ClassCastException
- iffromKey
andtoKey
cannot be compared to one another using this map's comparator (or, if the map has no comparator, using natural ordering). Implementations may, but are not required to, throw this exception iffromKey
ortoKey
cannot be compared to keys currently in the map.java.lang.NullPointerException
- iffromKey
ortoKey
is null and this map does not permit null keysjava.lang.IllegalArgumentException
- iffromKey
is greater thantoKey
; or if this map itself has a restricted range, andfromKey
ortoKey
lies outside the bounds of the range
-
headMap
ReadOnlySortedMap<K,V> headMap(K toKey)
Returns a view of the portion of this map whose keys are strictly less thantoKey
. 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 anIllegalArgumentException
on an attempt to insert a key outside its range.
Equivalent toheadMap(toKey, false)
.- Specified by:
headMap
in interfaceReadOnlySortedMap<K,V>
- Parameters:
toKey
- high endpoint (exclusive) of the keys in the returned map- Returns:
- a view of the portion of this map whose keys are strictly less than
toKey
- Throws:
java.lang.ClassCastException
- iftoKey
is not compatible with this map's comparator (or, if the map has no comparator, iftoKey
does not implementComparable
). Implementations may, but are not required to, throw this exception iftoKey
cannot be compared to keys currently in the map.java.lang.NullPointerException
- iftoKey
is null and this map does not permit null keysjava.lang.IllegalArgumentException
- if this map itself has a restricted range, andtoKey
lies outside the bounds of the range
-
tailMap
ReadOnlySortedMap<K,V> tailMap(K fromKey)
Returns a view of the portion of this map whose keys are greater than or equal tofromKey
. 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 anIllegalArgumentException
on an attempt to insert a key outside its range.
Equivalent totailMap(fromKey, true)
.- Specified by:
tailMap
in interfaceReadOnlySortedMap<K,V>
- Parameters:
fromKey
- low endpoint (inclusive) of the keys in the returned map- Returns:
- a view of the portion of this map whose keys are greater than or equal to
fromKey
- Throws:
java.lang.ClassCastException
- iffromKey
is not compatible with this map's comparator (or, if the map has no comparator, iffromKey
does not implementComparable
). Implementations may, but are not required to, throw this exception iffromKey
cannot be compared to keys currently in the map.java.lang.NullPointerException
- iffromKey
is null and this map does not permit null keysjava.lang.IllegalArgumentException
- if this map itself has a restricted range, andfromKey
lies outside the bounds of the range
-
reversed
default ReadOnlyNavigableMap<K,V> reversed()
Returns a reverse-ordered view of this map. The encounter order of mappings in the returned view is the inverse of the encounter order of mappings in this map. The reverse ordering affects all order-sensitive operations, including those on the view collections of the returned view.
This method is equivalent todescendingMap
.- Specified by:
reversed
in interfaceReadOnlySequencedMap<K,V>
- Specified by:
reversed
in interfaceReadOnlySortedMap<K,V>
- Returns:
- a reverse-ordered view of this map, as a
NavigableMap
- Code:
- Exact Method Body:
return this.descendingMap();
-
-