Package Torello.Java.ReadOnly
Interface ReadOnlySortedMap<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>
- All Known Subinterfaces:
ReadOnlyNavigableMap<K,V>
- All Known Implementing Classes:
ReadOnlyTreeMap
public interface ReadOnlySortedMap<K,V> extends ReadOnlySequencedMap<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 Collections Framework interfacejava.util.SortedMap<K, V>
. This interface contains all of the methods that the standard Java interface ReadOnlySortedMap contains - except those which would directly or indirectly modify / mutate the internal data-structure.
Hi-Lited Source-Code:- View Here: Torello/Java/ReadOnly/ReadOnlySortedMap.java
- Open New Browser-Tab: Torello/Java/ReadOnly/ReadOnlySortedMap.java
File Size: 9,354 Bytes Line Count: 198 '\n' Characters Found
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface Torello.Java.ReadOnly.ReadOnlyMap
ReadOnlyMap.Entry<K,V>
-
-
Method Summary
Retrieve a Set of all Map Keys Modifier and Type Method ReadOnlySet<K>
keySet()
Retrieve a Collection of all Map Values Modifier and Type Method ReadOnlyCollection<V>
values()
Retrieve a Set of Key-Value Pairs Modifier and Type Method ReadOnlySet<ReadOnlyMap.Entry<K,
V>>entrySet()
Retrieve a Map Key Modifier and Type Method K
firstKey()
K
lastKey()
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 this Map's Comparator Modifier and Type Method Comparator<? super K>
comparator()
Default Methods (Interface Methods with a Concrete, Default Implementation) Modifier and Type Method default ReadOnlySortedMap<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
firstEntry, lastEntry, sequencedEntrySet, sequencedKeySet, sequencedValues
-
-
-
-
Method Detail
-
comparator
java.util.Comparator<? super K> comparator()
Returns the comparator used to order the keys in this map, ornull
if this map uses thenatural ordering
of its keys.- Returns:
- the comparator used to order the keys in this map, or
null
if this map uses the natural ordering of its keys
-
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.- 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.- 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.- 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
-
firstKey
-
lastKey
-
keySet
ReadOnlySet<K> keySet()
Returns aReadOnlySet
view of the keys contained in this map. The set's iterator returns the keys in ascending order.- Specified by:
keySet
in interfaceReadOnlyMap<K,V>
- Returns:
- a set view of the keys contained in this map, sorted in ascending order
-
values
ReadOnlyCollection<V> values()
Returns aReadOnlyCollection
view of the values contained in this map. The collection's iterator returns the values in ascending order of the corresponding keys.- Specified by:
values
in interfaceReadOnlyMap<K,V>
- Returns:
- a collection view of the values contained in this map, sorted in ascending key order
-
entrySet
ReadOnlySet<ReadOnlyMap.Entry<K,V>> entrySet()
Returns aReadOnlySet
view of the mappings contained in this map. The set's iterator returns the entries in ascending key order.- Specified by:
entrySet
in interfaceReadOnlyMap<K,V>
- Returns:
- a set view of the mappings contained in this map, sorted in ascending key order
-
reversed
default ReadOnlySortedMap<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.- Specified by:
reversed
in interfaceReadOnlySequencedMap<K,V>
- Returns:
- a reverse-ordered view of this map, as a
ReadOnlySortedMap
- Code:
- Exact Method Body:
return JDKReverseOrderSortedMapView.of(this);
-
-