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 from GitHub'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 Java interface 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 the JDK-21 GitHub public (and, coincidentally, Read-Only) Source-Release archive for Java Package java.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 the GNU Public License V2 also be included alongside.
    Immutable variant of Java Collections Framework interface java.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.


    • Method Detail

      • comparator

        🡇     🗕  🗗  🗖
        java.util.Comparator<? super Ecomparator()
        Returns the comparator used to order the elements in this set, or null 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<EsubSet​(E fromElement,
                                    E toElement)
        Returns a view of the portion of this set whose elements range from fromElement, inclusive, to toElement, exclusive. (If fromElement and toElement 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 set
        toElement - high endpoint (exclusive) of the returned set
        Returns:
        a view of the portion of this set whose elements range from fromElement, inclusive, to toElement, exclusive
        Throws:
        java.lang.ClassCastException - if fromElement and toElement 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 if fromElement or toElement cannot be compared to elements currently in the set.
        java.lang.NullPointerException - if fromElement or toElement is null and this set does not permit null elements
        java.lang.IllegalArgumentException - if fromElement is greater than toElement; or if this set itself has a restricted range, and fromElement or toElement lies outside the bounds of the range
      • headSet

        🡅  🡇     🗕  🗗  🗖
        ReadOnlySortedSet<EheadSet​(E toElement)
        Returns a view of the portion of this set whose elements are strictly less than toElement. 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 - if toElement is not compatible with this set's comparator (or, if the set has no comparator, if toElement does not implement Comparable). Implementations may, but are not required to, throw this exception if toElement cannot be compared to elements currently in the set.
        java.lang.NullPointerException - if toElement is null and this set does not permit null elements
        java.lang.IllegalArgumentException - if this set itself has a restricted range, and toElement lies outside the bounds of the range
      • tailSet

        🡅  🡇     🗕  🗗  🗖
        ReadOnlySortedSet<EtailSet​(E fromElement)
        Returns a view of the portion of this set whose elements are greater than or equal to fromElement. 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 - if fromElement is not compatible with this set's comparator (or, if the set has no comparator, if fromElement does not implement Comparable). Implementations may, but are not required to, throw this exception if fromElement cannot be compared to elements currently in the set.
        java.lang.NullPointerException - if fromElement is null and this set does not permit null elements
        java.lang.IllegalArgumentException - if this set itself has a restricted range, and fromElement lies outside the bounds of the range
      • first

        🡅  🡇     🗕  🗗  🗖
        E first()
        Returns the first (lowest) element currently in this set.
        Returns:
        the first (lowest) element currently in this set
        Throws:
        NoSuchElementException - if this set is empty
      • last

        🡅  🡇     🗕  🗗  🗖
        E last()
        Returns the last (highest) element currently in this set.
        Returns:
        the last (highest) element currently in this set
        Throws:
        NoSuchElementException - if this set is empty
      • spliterator

        🡅  🡇     🗕  🗗  🗖
        default java.util.Spliterator<Espliterator()
        Creates a Spliterator over the elements in this sorted set.

        The Spliterator reports Spliterator.DISTINCT, Spliterator.SORTED}. Implementations should document the reporting of additional characteristic values.

        The spliterator's comparator (see Spliterator.getComparator()) must be null if the sorted set's comparator (see comparator()) is null. 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 interface java.lang.Iterable<E>
        Specified by:
        spliterator in interface ReadOnlyCollection<E>
        Specified by:
        spliterator in interface ReadOnlySet<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(); }
         };
        
      • reversed

        🡅     🗕  🗗  🗖
        default ReadOnlySortedSet<Ereversed()
        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 interface ReadOnlySequencedCollection<E>
        Specified by:
        reversed in interface ReadOnlySequencedSet<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);