Class CollectionsExt.ImmutableSortedMultiSet<E>

    • Constructor Detail

      • ImmutableSortedMultiSet

        ImmutableSortedMultiSet​(SortedMultiSet<E> mSet)
        Creates a new empty ImmutableSortedMultiSet which equals mSet but cannot be modified neither directly nor via its iterator. y
        Throws:
        java.lang.NullPointerException - if coll==null.
    • Method Detail

      • getSet

        public java.util.SortedSet<E> getSet()
        Description copied from interface: MultiSet
        Returns a view of the underlying set of this MultiSet. For certain implementations, this set is immutable to prevent implicit modification of this MultiSet.
        Specified by:
        getSet in interface MultiSet<E>
        Specified by:
        getSet in interface SortedMultiSet<E>
        Overrides:
        getSet in class CollectionsExt.AbstractImmutableMultiSet<SortedMultiSet<E>,​E>
        Returns:
        the Set containing exactly the objects with strictly positive multiplicity in this MultiSet.
      • comparator

        public java.util.Comparator<? super E> comparator()
        Description copied from interface: SortedMultiSet
        Returns the comparator used to order the elements in this set, or null if this set uses the natural ordering of its elements.
        Specified by:
        comparator in interface SortedMultiSet<E>
        Returns:
        the comparator used to order the elements in this set, or null if this set uses the natural ordering of its elements.
      • first

        public E first()
        Description copied from interface: SortedMultiSet
        Returns the first (lowest) element currently in this set.
        Specified by:
        first in interface SortedMultiSet<E>
        Returns:
        the first (lowest) element currently in this set
      • last

        public E last()
        Description copied from interface: SortedMultiSet
        Returns the last (highest) element currently in this set.
        Specified by:
        last in interface SortedMultiSet<E>
        Returns:
        the last (highest) element currently in this set.
      • headSet

        public SortedMultiSet<E> headSet​(E toElement)
        Description copied from interface: SortedMultiSet
        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.

        Specified by:
        headSet in interface SortedMultiSet<E>
        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.
      • tailSet

        public SortedMultiSet<E> tailSet​(E fromElement)
        Description copied from interface: SortedMultiSet
        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.

        Specified by:
        tailSet in interface SortedMultiSet<E>
        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.
      • subSet

        public SortedMultiSet<E> subSet​(E fromElement,
                                        E toElement)
        Description copied from interface: SortedMultiSet
        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.

        Specified by:
        subSet in interface SortedMultiSet<E>
        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.