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-JDKAccount. Though the original file has been modified, few changes have been applied to the Javadoc Commenting. Due to fact that that is a Javainterfacefile, 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 GitHubpublic (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 V2also 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,289 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 KfloorKey(K key)KlowerKey(K key)Retrieve the Greatest Map Key Modifier and Type Method KceilingKey(K key)KhigherKey(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
cloneToMap, 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, wrapToImmutableMap
-
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, ornullif there is no such key.- Parameters:
key- the key- Returns:
- an entry with the greatest key less than
key, ornullif 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, ornullif there is no such key.- Parameters:
key- the key- Returns:
- the greatest key less than
key, ornullif 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, ornullif there is no such key.- Parameters:
key- the key- Returns:
- an entry with the greatest key less than or equal to
key, ornullif 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, ornullif there is no such key.- Parameters:
key- the key- Returns:
- the greatest key less than or equal to
key, ornullif 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, ornullif there is no such key.- Parameters:
key- the key- Returns:
- an entry with the least key greater than or equal to
key, ornullif 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, ornullif there is no such key.- Parameters:
key- the key- Returns:
- the least key greater than or equal to
key, ornullif 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, ornullif there is no such key.- Parameters:
key- the key- Returns:
- an entry with the least key greater than
key, ornullif 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, ornullif there is no such key.- Parameters:
key- the key- Returns:
- the least key greater than
key, ornullif 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, ornullif the map is empty.- Specified by:
firstEntryin interfaceReadOnlySequencedMap<K,V>- Returns:
- an entry with the least key, or
nullif this map is empty
-
lastEntry
ReadOnlyMap.Entry<K,V> lastEntry()
Returns a key-value mapping associated with the greatest key in this map, ornullif the map is empty.- Specified by:
lastEntryin interfaceReadOnlySequencedMap<K,V>- Returns:
- an entry with the greatest key, or
nullif 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 aReadOnlyNavigableSetview 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 orderReadOnlyNavigableSetview 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 fromfromKeytotoKey. IffromKeyandtoKeyare equal, the returned map is empty unlessfromInclusiveandtoInclusiveare 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-TRUEif the low endpoint is to be included in the returned viewtoKey- high endpoint of the keys in the returned maptoInclusive-TRUEif the high endpoint is to be included in the returned view- Returns:
- a view of the portion of this map whose keys range from
fromKeytotoKey - Throws:
java.lang.ClassCastException- iffromKeyandtoKeycannot 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 iffromKeyortoKeycannot be compared to keys currently in the map.java.lang.NullPointerException- iffromKeyortoKeyis null and this map does not permit null keysjava.lang.IllegalArgumentException- iffromKeyis greater thantoKey; or if this map itself has a restricted range, andfromKeyortoKeylies 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, ifinclusiveis 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-TRUEif 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
inclusiveis true)toKey - Throws:
java.lang.ClassCastException- iftoKeyis not compatible with this map's comparator (or, if the map has no comparator, iftoKeydoes not implementComparable). Implementations may, but are not required to, throw this exception iftoKeycannot be compared to keys currently in the map.java.lang.NullPointerException- iftoKeyis null and this map does not permit null keysjava.lang.IllegalArgumentException- if this map itself has a restricted range, andtoKeylies 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, ifinclusiveis 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-TRUEif 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
inclusiveis true)fromKey - Throws:
java.lang.ClassCastException- iffromKeyis not compatible with this map's comparator (or, if the map has no comparator, iffromKeydoes not implementComparable). Implementations may, but are not required to, throw this exception iffromKeycannot be compared to keys currently in the map.java.lang.NullPointerException- iffromKeyis null and this map does not permit null keysjava.lang.IllegalArgumentException- if this map itself has a restricted range, andfromKeylies 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. (IffromKeyandtoKeyare 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 anIllegalArgumentExceptionon an attempt to insert a key outside its range.
Equivalent tosubMap(fromKey, true, toKey, false).- Specified by:
subMapin 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- iffromKeyandtoKeycannot 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 iffromKeyortoKeycannot be compared to keys currently in the map.java.lang.NullPointerException- iffromKeyortoKeyis null and this map does not permit null keysjava.lang.IllegalArgumentException- iffromKeyis greater thantoKey; or if this map itself has a restricted range, andfromKeyortoKeylies 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 anIllegalArgumentExceptionon an attempt to insert a key outside its range.
Equivalent toheadMap(toKey, false).- Specified by:
headMapin 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- iftoKeyis not compatible with this map's comparator (or, if the map has no comparator, iftoKeydoes not implementComparable). Implementations may, but are not required to, throw this exception iftoKeycannot be compared to keys currently in the map.java.lang.NullPointerException- iftoKeyis null and this map does not permit null keysjava.lang.IllegalArgumentException- if this map itself has a restricted range, andtoKeylies 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 anIllegalArgumentExceptionon an attempt to insert a key outside its range.
Equivalent totailMap(fromKey, true).- Specified by:
tailMapin 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- iffromKeyis not compatible with this map's comparator (or, if the map has no comparator, iffromKeydoes not implementComparable). Implementations may, but are not required to, throw this exception iffromKeycannot be compared to keys currently in the map.java.lang.NullPointerException- iffromKeyis null and this map does not permit null keysjava.lang.IllegalArgumentException- if this map itself has a restricted range, andfromKeylies 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:
reversedin interfaceReadOnlySequencedMap<K,V>- Specified by:
reversedin interfaceReadOnlySortedMap<K,V>- Returns:
- a reverse-ordered view of this map, as a
NavigableMap - Code:
- Exact Method Body:
return this.descendingMap();
-
-