Package Torello.Java.ReadOnly
Interface ReadOnlySequencedMap<K,V>
-
- Type Parameters:
K
- the type of keys maintained by this mapV
- the type of mapped values
- All Superinterfaces:
ReadOnlyMap<K,V>
- All Known Subinterfaces:
ReadOnlyNavigableMap<K,V>
,ReadOnlySortedMap<K,V>
- All Known Implementing Classes:
ReadOnlyTreeMap
public interface ReadOnlySequencedMap<K,V> extends ReadOnlyMap<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.SequencedMap<K, V>
. This interface contains all of the methods that the standard Java interface ReadOnlySequencedMap contains - except those which would directly or indirectly modify / mutate the internal data-structure.
Hi-Lited Source-Code:- View Here: Torello/Java/ReadOnly/ReadOnlySequencedMap.java
- Open New Browser-Tab: Torello/Java/ReadOnly/ReadOnlySequencedMap.java
File Size: 8,148 Bytes Line Count: 196 '\n' Characters Found
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface Torello.Java.ReadOnly.ReadOnlyMap
ReadOnlyMap.Entry<K,V>
-
-
Method Summary
Retrieve a Reverse-Ordered Map Modifier and Type Method ReadOnlySequencedMap<K,V>
reversed()
Default Methods: Retrieve a Key-Value Pair Modifier and Type Method default ReadOnlyMap.Entry<K,V>
firstEntry()
default ReadOnlyMap.Entry<K,V>
lastEntry()
Default Methods: Retrieve a Sequenced-Set of Map Keys or Values Modifier and Type Method default ReadOnlySequencedSet<K>
sequencedKeySet()
default ReadOnlySequencedCollection<V>
sequencedValues()
Default Methods: Retrieve a Sequenced-Set of Key-Value Pairs Modifier and Type Method default ReadOnlySequencedSet<ReadOnlyMap.Entry<K,
V>>sequencedEntrySet()
-
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, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, size, values
-
-
-
-
Method Detail
-
reversed
ReadOnlySequencedMap<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.- Returns:
- a reverse-ordered view of this map
-
firstEntry
default ReadOnlyMap.Entry<K,V> firstEntry()
Returns the first key-value mapping in this map, ornull
if the map is empty.- Returns:
- the first key-value mapping, or
null
if this map is empty - Code:
- Exact Method Body:
RemoveUnsupportedIterator<ReadOnlyMap.Entry<K, V>> it = entrySet().iterator(); return it.hasNext() ? it.next() : null; // return it.hasNext() ? new NullableKeyValueHolder<>(it.next()) : null;
-
lastEntry
default ReadOnlyMap.Entry<K,V> lastEntry()
Returns the last key-value mapping in this map, ornull
if the map is empty.- Returns:
- the last key-value mapping, or
null
if this map is empty - Code:
- Exact Method Body:
RemoveUnsupportedIterator<ReadOnlyMap.Entry<K, V>> it = reversed().entrySet().iterator(); return it.hasNext() ? it.next() : null; // return it.hasNext() ? new NullableKeyValueHolder<>(it.next()) : null;
-
sequencedKeySet
default ReadOnlySequencedSet<K> sequencedKeySet()
Returns aSequencedSet
view of this map'skeySet
.- Returns:
- a
SequencedSet
view of this map'skeySet
- Code:
- Exact Method Body:
class ReadOnlySeqKeySet extends AbstractReadOnlyMap.ViewCollection<K> implements ReadOnlySequencedSet<K> { public ReadOnlyCollection<K> view() { return ReadOnlySequencedMap.this.keySet(); } public ReadOnlySequencedSet<K> reversed() { return ReadOnlySequencedMap.this.reversed().sequencedKeySet(); } public boolean equals(Object other) { return view().equals(other); } public int hashCode() { return view().hashCode(); } } return new ReadOnlySeqKeySet();
-
sequencedValues
default ReadOnlySequencedCollection<V> sequencedValues()
Returns aSequencedCollection
view of this map'svalues
collection.- Returns:
- a
SequencedCollection
view of this map'svalues
collection - Code:
- Exact Method Body:
class ReadOnlySeqValues extends AbstractReadOnlyMap.ViewCollection<V> implements ReadOnlySequencedCollection<V> { public ReadOnlyCollection<V> view() { return ReadOnlySequencedMap.this.values(); } public ReadOnlySequencedCollection<V> reversed() { return ReadOnlySequencedMap.this.reversed().sequencedValues(); } } return new ReadOnlySeqValues();
-
sequencedEntrySet
default ReadOnlySequencedSet<ReadOnlyMap.Entry<K,V>> sequencedEntrySet()
Returns aSequencedSet
view of this map'sentrySet
.- Returns:
- a
SequencedSet
view of this map'sentrySet
- Code:
- Exact Method Body:
class ReadOnlySeqEntrySet extends AbstractReadOnlyMap.ViewCollection<ReadOnlyMap.Entry<K, V>> implements ReadOnlySequencedSet<ReadOnlyMap.Entry<K, V>> { public ReadOnlyCollection<ReadOnlyMap.Entry<K, V>> view() { return ReadOnlySequencedMap.this.entrySet(); } public ReadOnlySequencedSet<ReadOnlyMap.Entry<K, V>> reversed() { return ReadOnlySequencedMap.this.reversed().sequencedEntrySet(); } public boolean equals(Object other) { return view().equals(other); } public int hashCode() { return view().hashCode(); } } return new ReadOnlySeqEntrySet();
-
-