Package Torello.Java.ReadOnly
Interface ReadOnlyNavigableSet<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>
,ReadOnlySortedSet<E>
- All Known Implementing Classes:
ReadOnlyTreeSet
public interface ReadOnlyNavigableSet<E> extends ReadOnlySortedSet<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.NavigableSet<E>
. This interface contains all of the methods that the standard Java interface ReadOnlyNavigableSet contains - except those which would directly or indirectly modify / mutate the internal data-structure.
Hi-Lited Source-Code:- View Here: Torello/Java/ReadOnly/ReadOnlyNavigableSet.java
- Open New Browser-Tab: Torello/Java/ReadOnly/ReadOnlyNavigableSet.java
File Size: 11,602 Bytes Line Count: 279 '\n' Characters Found
-
-
Method Summary
Retrieve the Least Set Element Modifier and Type Method E
floor(E e)
E
lower(E e)
Retrieve the Greatest Set Element Modifier and Type Method E
ceiling(E e)
E
higher(E e)
Retrieve a Sub-Set as a ReadOnlyNavigableSet Modifier and Type Method ReadOnlyNavigableSet<E>
headSet(E toElement, boolean inclusive)
ReadOnlyNavigableSet<E>
subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
ReadOnlyNavigableSet<E>
tailSet(E fromElement, boolean inclusive)
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 a Reverse-Ordered Set Modifier and Type Method ReadOnlyNavigableSet<E>
descendingSet()
Default Methods (Interface Methods with a Concrete, Default Implementation) Modifier and Type Method default ReadOnlyNavigableSet<E>
reversed()
Methods: interface java.lang.Iterable Modifier and Type Method RemoveUnsupportedIterator<E>
descendingIterator()
RemoveUnsupportedIterator<E>
iterator()
-
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, size, toArray, toArray
-
Methods inherited from interface Torello.Java.ReadOnly.ReadOnlySortedSet
comparator, first, getFirst, getLast, last, spliterator
-
-
-
-
Method Detail
-
lower
E lower(E e)
Returns the greatest element in this set strictly less than the given element, ornull
if there is no such element.- Parameters:
e
- the value to match- Returns:
- the greatest element less than
e
, ornull
if there is no such element - Throws:
java.lang.ClassCastException
- if the specified element cannot be compared with the elements currently in the setjava.lang.NullPointerException
- if the specified element is null and this set does not permit null elements
-
floor
E floor(E e)
Returns the greatest element in this set less than or equal to the given element, ornull
if there is no such element.- Parameters:
e
- the value to match- Returns:
- the greatest element less than or equal to
e
, ornull
if there is no such element - Throws:
java.lang.ClassCastException
- if the specified element cannot be compared with the elements currently in the setjava.lang.NullPointerException
- if the specified element is null and this set does not permit null elements
-
ceiling
E ceiling(E e)
Returns the least element in this set greater than or equal to the given element, ornull
if there is no such element.- Parameters:
e
- the value to match- Returns:
- the least element greater than or equal to
e
, ornull
if there is no such element - Throws:
java.lang.ClassCastException
- if the specified element cannot be compared with the elements currently in the setjava.lang.NullPointerException
- if the specified element is null and this set does not permit null elements
-
higher
E higher(E e)
Returns the least element in this set strictly greater than the given element, ornull
if there is no such element.- Parameters:
e
- the value to match- Returns:
- the least element greater than
e
, ornull
if there is no such element - Throws:
java.lang.ClassCastException
- if the specified element cannot be compared with the elements currently in the setjava.lang.NullPointerException
- if the specified element is null and this set does not permit null elements
-
iterator
RemoveUnsupportedIterator<E> iterator()
Returns an iterator over the elements in this set, in ascending order.- Specified by:
iterator
in interfacejava.lang.Iterable<E>
- Specified by:
iterator
in interfaceReadOnlyCollection<E>
- Specified by:
iterator
in interfaceReadOnlySet<E>
- Returns:
- an iterator over the elements in this set, in ascending order
-
descendingSet
ReadOnlyNavigableSet<E> descendingSet()
Returns a reverse order view of the elements contained in this set.
The expressions.descendingSet().descendingSet()
returns a view ofs
essentially equivalent tos
.- Returns:
- a reverse order view of this set
-
descendingIterator
RemoveUnsupportedIterator<E> descendingIterator()
Returns an iterator over the elements in this set, in descending order. Equivalent in effect todescendingSet().iterator()
.- Returns:
- an iterator over the elements in this set, in descending order
-
subSet
ReadOnlyNavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
Returns a view of the portion of this set whose elements range fromfromElement
totoElement
. IffromElement
andtoElement
are equal, the returned set is empty unlessfromInclusive
andtoInclusive
are both true. The returned set supports all optional set operations that this set supports.- Parameters:
fromElement
- low endpoint of the returned setfromInclusive
-TRUE
if the low endpoint is to be included in the returned viewtoElement
- high endpoint of the returned settoInclusive
-TRUE
if the high endpoint is to be included in the returned view- 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
ReadOnlyNavigableSet<E> headSet(E toElement, boolean inclusive)
Returns a view of the portion of this set whose elements are less than (or equal to, ifinclusive
is true)toElement
.- Parameters:
toElement
- high endpoint of the returned setinclusive
-TRUE
if the high endpoint is to be included in the returned view- Returns:
- a view of the portion of this set whose elements are less than (or equal to, if
inclusive
is true)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
ReadOnlyNavigableSet<E> tailSet(E fromElement, boolean inclusive)
Returns a view of the portion of this set whose elements are greater than (or equal to, ifinclusive
is true)fromElement
.- Parameters:
fromElement
- low endpoint of the returned setinclusive
-TRUE
if the low endpoint is to be included in the returned view- 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
-
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.
Equivalent tosubSet(fromElement, true, toElement, false)
.- Specified by:
subSet
in interfaceReadOnlySortedSet<E>
- 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.
Equivalent toheadSet(toElement, false)
.- Specified by:
headSet
in interfaceReadOnlySortedSet<E>
- 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.
Equivalent totailSet(fromElement, true)
.- Specified by:
tailSet
in interfaceReadOnlySortedSet<E>
- 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
-
reversed
default ReadOnlyNavigableSet<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.
This method is equivalent todescendingSet
.- Specified by:
reversed
in interfaceReadOnlySequencedCollection<E>
- Specified by:
reversed
in interfaceReadOnlySequencedSet<E>
- Specified by:
reversed
in interfaceReadOnlySortedSet<E>
- Returns:
- a reverse-ordered view of this collection, as a
NavigableSet
- Code:
- Exact Method Body:
return this.descendingSet();
-
-