Interface SortedMultiSet<T>

    • Method Detail

      • getSet

        SortedSet<T> getSet()
        Returns a view of the underlying sorted set of this SortedMultiSet. For certain implementations, this set is immutable to prevent implicit modification of this SortedMultiSet.
        Specified by:
        getSet in interface MultiSet<T>
        Returns:
        the SortedSet containing exactly the objects with strictly positive multiplicity in this SortedMultiSet.
      • comparator

        Comparator<? super T> comparator()
        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.
      • first

        T 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

        T 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.
      • headSet

        SortedMultiSet<T> headSet​(T toElement)
        Returns a view of the portion of this multi-set whose elements are strictly less than toElement. The returned multi-set is backed by this multi-set, so changes in the returned set are reflected in this multi-set, and vice-versa. The returned multi-set supports all optional multi-set operations that this multi-set supports.

        The returned multi-set will throw an IllegalArgumentException on an attempt to insert an element outside its range.

        Parameters:
        toElement - high endpoint (exclusive) of the returned multi-set.
        Returns:
        a view of the portion of this multi-set whose elements are strictly less than toElement.
        Throws:
        ClassCastException - if toElement is not compatible with this multi-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 this multi-set.
        NullPointerException - if toElement is null and this multi-set does not permit null elements.
        IllegalArgumentException - if this multi-set itself has a restricted range, and toElement lies outside the bounds of the range.
      • tailSet

        SortedMultiSet<T> tailSet​(T fromElement)
        Returns a view of the portion of this multi-set whose elements are greater than or equal to fromElement. The returned multi-set is backed by this multi-set, so changes in the returned set are reflected in this multi-set, and vice-versa. The returned multi-set supports all optional multi-set operations that this multi-set supports.

        The returned multi-set will throw an IllegalArgumentException on an attempt to insert an element outside its range.

        Parameters:
        fromElement - low endpoint (inclusive) of the returned multi-set.
        Returns:
        a view of the portion of this multi-set whose elements are greater than or equal to fromElement.
        Throws:
        ClassCastException - if fromElement is not compatible with this multi-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 this multi-set.
        NullPointerException - if fromElement is null and this multi-set does not permit null elements.
        IllegalArgumentException - if this multi-set itself has a restricted range, and fromElement lies outside the bounds of the range.
      • subSet

        SortedMultiSet<T> subSet​(T fromElement,
                                 T toElement)
        Returns a view of the portion of this multi-set whose elements range from fromElement inclusively to toElement exclusively. The returned multi-set is backed by this multi-set, so changes in the returned set are reflected in this multi-set, and vice-versa. The returned multi-set supports all optional multi-set operations that this multi-set supports.

        The returned multi-set will throw an IllegalArgumentException on an attempt to insert an element outside its range.

        Parameters:
        fromElement - low endpoint (inclusive) of the returned multi-set.
        toElement - high endpoint (exclusive) of the returned multi-set.
        Returns:
        a view of the portion of this multi-set from fromElement inclusively to toElement exclusively.
        Throws:
        ClassCastException - **** maybe original documentation wrong. **** 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). or if fromElement is not compatible with this multi-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 or toElement cannot be compared to elements currently in this multi-set.
        NullPointerException - if fromElement or toElement is null and this multi-set does not permit null elements.
        IllegalArgumentException - if fromElement is greater than toElement or if this multi-set itself has a restricted range, and fromElement or toElement lies outside the bounds of the range.