Package Torello.Java.ReadOnly
Interface ReadOnlySortedSet<E>
-
- Type Parameters:
E
- the type of elements maintained by this set
- All Superinterfaces:
java.lang.Iterable<E>
,ReadOnlyCollection<E>
,ReadOnlySequencedCollection<E>
,ReadOnlySequencedSet<E>
,ReadOnlySet<E>
- All Known Subinterfaces:
ReadOnlyNavigableSet<E>
- All Known Implementing Classes:
ReadOnlyTreeSet
public interface ReadOnlySortedSet<E> extends ReadOnlySet<E>, ReadOnlySequencedSet<E>
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.SortedSet<E>
. This interface contains all of the methods that the standard Java interface ReadOnlySortedSet contains - except those which would directly or indirectly modify / mutate the internal data-structure.
Hi-Lited Source-Code:- View Here: Torello/Java/ReadOnly/ReadOnlySortedSet.java
- Open New Browser-Tab: Torello/Java/ReadOnly/ReadOnlySortedSet.java
File Size: 10,832 Bytes Line Count: 241 '\n' Characters Found
-
-
Method Summary
Retrieve a Set Element Modifier and Type Method E
first()
E
last()
Retrieve a Sub-Set as a ReadOnlySortedSet Modifier and Type Method ReadOnlySortedSet<E>
headSet(E toElement)
ReadOnlySortedSet<E>
subSet(E fromElement, E toElement)
ReadOnlySortedSet<E>
tailSet(E fromElement)
Retrieve this Set's Comparator Modifier and Type Method Comparator<? super E>
comparator()
Default Methods (Interface Methods with a Concrete, Default Implementation) Modifier and Type Method default E
getFirst()
default E
getLast()
default ReadOnlySortedSet<E>
reversed()
default Spliterator<E>
spliterator()
-
Methods inherited from interface Torello.Java.ReadOnly.ReadOnlyCollection
containsAND, containsAND, containsNAND, containsNAND, containsOR, containsOR, containsXOR, containsXOR, copyIntoCollection, parallelStream, stream, toArray
-
Methods inherited from interface Torello.Java.ReadOnly.ReadOnlySet
contains, containsAll, equals, hashCode, isEmpty, iterator, size, toArray, toArray
-
-
-
-
Method Detail
-
comparator
java.util.Comparator<? super E> comparator()
Returns the comparator used to order the elements in this set, ornull
if this set uses the natural ordering of its elements.- Returns:
- the comparator used to order the elements in this set, or
null
if this set uses the natural ordering of its elements
-
subSet
ReadOnlySortedSet<E> subSet(E fromElement, E toElement)
Returns a view of the portion of this set whose elements range fromfromElement
, inclusive, totoElement
, exclusive. (IffromElement
andtoElement
are equal, the returned set is empty.) The returned set supports all optional set operations that this set supports.- Parameters:
fromElement
- low endpoint (inclusive) of the returned settoElement
- high endpoint (exclusive) of the returned set- Returns:
- a view of the portion of this set whose elements range from
fromElement
, inclusive, totoElement
, exclusive - Throws:
java.lang.ClassCastException
- iffromElement
andtoElement
cannot be compared to one another using this set's comparator (or, if the set has no comparator, using natural ordering). Implementations may, but are not required to, throw this exception iffromElement
ortoElement
cannot be compared to elements currently in the set.java.lang.NullPointerException
- iffromElement
ortoElement
is null and this set does not permit null elementsjava.lang.IllegalArgumentException
- iffromElement
is greater thantoElement
; or if this set itself has a restricted range, andfromElement
ortoElement
lies outside the bounds of the range
-
headSet
ReadOnlySortedSet<E> headSet(E toElement)
Returns a view of the portion of this set whose elements are strictly less thantoElement
. The returned set supports all optional set operations that this set supports.- Parameters:
toElement
- high endpoint (exclusive) of the returned set- Returns:
- a view of the portion of this set whose elements are strictly less than
toElement
- Throws:
java.lang.ClassCastException
- iftoElement
is not compatible with this set's comparator (or, if the set has no comparator, iftoElement
does not implementComparable
). Implementations may, but are not required to, throw this exception iftoElement
cannot be compared to elements currently in the set.java.lang.NullPointerException
- iftoElement
is null and this set does not permit null elementsjava.lang.IllegalArgumentException
- if this set itself has a restricted range, andtoElement
lies outside the bounds of the range
-
tailSet
ReadOnlySortedSet<E> tailSet(E fromElement)
Returns a view of the portion of this set whose elements are greater than or equal tofromElement
. The returned set supports all optional set operations that this set supports.- Parameters:
fromElement
- low endpoint (inclusive) of the returned set- Returns:
- a view of the portion of this set whose elements are greater than or equal to
fromElement
- Throws:
java.lang.ClassCastException
- iffromElement
is not compatible with this set's comparator (or, if the set has no comparator, iffromElement
does not implementComparable
). Implementations may, but are not required to, throw this exception iffromElement
cannot be compared to elements currently in the set.java.lang.NullPointerException
- iffromElement
is null and this set does not permit null elementsjava.lang.IllegalArgumentException
- if this set itself has a restricted range, andfromElement
lies outside the bounds of the range
-
first
-
last
-
spliterator
default java.util.Spliterator<E> spliterator()
Creates aSpliterator
over the elements in this sorted set.
TheSpliterator
reportsSpliterator.DISTINCT
,Spliterator.SORTED
}. Implementations should document the reporting of additional characteristic values.
The spliterator's comparator (seeSpliterator.getComparator()
) must benull
if the sorted set's comparator (seecomparator()
) isnull
. Otherwise, the spliterator's comparator must be the same as or impose the same total ordering as the sorted set's comparator.- Specified by:
spliterator
in interfacejava.lang.Iterable<E>
- Specified by:
spliterator
in interfaceReadOnlyCollection<E>
- Specified by:
spliterator
in interfaceReadOnlySet<E>
- Returns:
- a
Spliterator
over the elements in this sorted set - Code:
- Exact Method Body:
// *** Java-HTML: Some Spliterators Code was copied into this package return new Iterator_Spliterator<E> (this, Spliterator.DISTINCT | Spliterator.SORTED | Spliterator.ORDERED) { @Override public Comparator<? super E> getComparator() { return ReadOnlySortedSet.this.comparator(); } };
-
getFirst
default E getFirst()
Gets the first element of this collection.- Specified by:
getFirst
in interfaceReadOnlySequencedCollection<E>
- Returns:
- the retrieved element
- Throws:
NoSuchElementException
- Code:
- Exact Method Body:
return this.first();
-
getLast
default E getLast()
Gets the last element of this collection.- Specified by:
getLast
in interfaceReadOnlySequencedCollection<E>
- Returns:
- the retrieved element
- Throws:
NoSuchElementException
- Code:
- Exact Method Body:
return this.last();
-
reversed
default ReadOnlySortedSet<E> reversed()
Returns a reverse-ordered view of this collection. The encounter order of elements in the returned view is the inverse of the encounter order of elements in this collection. The reverse ordering affects all order-sensitive operations, including those on the view collections of the returned view.- Specified by:
reversed
in interfaceReadOnlySequencedCollection<E>
- Specified by:
reversed
in interfaceReadOnlySequencedSet<E>
- Returns:
- a reverse-ordered view of this collection, as a
ReadOnlySortedSet
- Code:
- Exact Method Body:
// *** Java-HTML: This is the use of the ReverseOrderedSortedSetView // This was copied out of "Package-Private" stuff for the JDK 21 // from the OpenJDK class on Git-Hub return JDKReverseOrderSortedSetView.of(this);
-
-