Class ImmutableSortedSet<E>
- java.lang.Object
- 
- java.util.AbstractCollection<E>
- 
- com.google.common.collect.ImmutableCollection<E>
- 
- com.google.common.collect.ImmutableSet<E>
- 
- com.google.common.collect.ImmutableSortedSet<E>
 
 
 
 
- 
- All Implemented Interfaces:
- Serializable,- Iterable<E>,- Collection<E>,- NavigableSet<E>,- Set<E>,- SortedSet<E>
 - Direct Known Subclasses:
- ContiguousSet
 
 @GwtCompatible(serializable=true, emulated=true) public abstract class ImmutableSortedSet<E> extends ImmutableSet<E> implements NavigableSet<E> ANavigableSetwhose contents will never change, with many other important properties detailed atImmutableCollection.Warning: as with any sorted collection, you are strongly advised not to use a ComparatororComparabletype whose comparison behavior is inconsistent with equals. That is,a.compareTo(b)orcomparator.compare(a, b)should equal zero if and only ifa.equals(b). If this advice is not followed, the resulting collection will not correctly obey its specification.See the Guava User Guide article on immutable collections. - Since:
- 2.0 (implements NavigableSetsince 12.0)
- Author:
- Jared Levy, Louis Wasserman
- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classImmutableSortedSet.Builder<E>A builder for creating immutable sorted set instances, especiallypublic static finalsets ("constant sets"), with a given comparator.
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ImmutableList<E>asList()Returns anImmutableListcontaining the same elements, in the same order, as this collection.static <E> ImmutableSortedSet.Builder<E>builder()Deprecated.UsenaturalOrder(), which offers better type-safety.static <E> ImmutableSortedSet.Builder<E>builderWithExpectedSize(int expectedSize)Deprecated.Not supported by ImmutableSortedSet.Eceiling(E e)Returns the least element in this set greater than or equal to the given element, ornullif there is no such element.Comparator<? super E>comparator()Returns the comparator that orders the elements, which isOrdering.natural()when the natural ordering of the elements is used.static <E extends Comparable<? super E>>
 ImmutableSortedSet<E>copyOf(E[] elements)Returns an immutable sorted set containing the given elements sorted by their natural ordering.static <E> ImmutableSortedSet<E>copyOf(E[] elements)Deprecated.Pass parameters of typeComparableto usecopyOf(Comparable[]).static <E> ImmutableSortedSet<E>copyOf(Iterable<? extends E> elements)Returns an immutable sorted set containing the given elements sorted by their natural ordering.static <E> ImmutableSortedSet<E>copyOf(Collection<? extends E> elements)Returns an immutable sorted set containing the given elements sorted by their natural ordering.static <E> ImmutableSortedSet<E>copyOf(Comparator<? super E> comparator, Iterable<? extends E> elements)Returns an immutable sorted set containing the given elements sorted by the givenComparator.static <E> ImmutableSortedSet<E>copyOf(Comparator<? super E> comparator, Collection<? extends E> elements)Returns an immutable sorted set containing the given elements sorted by the givenComparator.static <E> ImmutableSortedSet<E>copyOf(Comparator<? super E> comparator, Iterator<? extends E> elements)Returns an immutable sorted set containing the given elements sorted by the givenComparator.static <E> ImmutableSortedSet<E>copyOf(Iterator<? extends E> elements)Returns an immutable sorted set containing the given elements sorted by their natural ordering.static <E> ImmutableSortedSet<E>copyOfSorted(SortedSet<E> sortedSet)Returns an immutable sorted set containing the elements of a sorted set, sorted by the sameComparator.abstract UnmodifiableIterator<E>descendingIterator()Returns an iterator over the elements in this set, in descending order.ImmutableSortedSet<E>descendingSet()Returns a reverse order view of the elements contained in this set.Efirst()Returns the first (lowest) element currently in this set.Efloor(E e)Returns the greatest element in this set less than or equal to the given element, ornullif there is no such element.ImmutableSortedSet<E>headSet(E toElement)Returns a view of the portion of this set whose elements are strictly less thantoElement.ImmutableSortedSet<E>headSet(E toElement, boolean inclusive)Returns a view of the portion of this set whose elements are less than (or equal to, ifinclusiveis true)toElement.Ehigher(E e)Returns the least element in this set strictly greater than the given element, ornullif there is no such element.abstract UnmodifiableIterator<E>iterator()Returns an unmodifiable iterator across the elements in this collection.Elast()Returns the last (highest) element currently in this set.Elower(E e)Returns the greatest element in this set strictly less than the given element, ornullif there is no such element.static <E extends Comparable<?>>
 ImmutableSortedSet.Builder<E>naturalOrder()Returns a builder that creates immutable sorted sets whose elements are ordered by their natural ordering.static <E> ImmutableSortedSet<E>of()Returns the empty immutable sorted set.static <E extends Comparable<? super E>>
 ImmutableSortedSet<E>of(E element)Returns an immutable sorted set containing a single element.static <E> ImmutableSortedSet<E>of(E element)Deprecated.Pass a parameter of typeComparableto useof(Comparable).static <E extends Comparable<? super E>>
 ImmutableSortedSet<E>of(E e1, E e2)Returns an immutable sorted set containing the given elements sorted by their natural ordering.static <E> ImmutableSortedSet<E>of(E e1, E e2)Deprecated.Pass the parameters of typeComparableto useof(Comparable, Comparable).static <E extends Comparable<? super E>>
 ImmutableSortedSet<E>of(E e1, E e2, E e3)Returns an immutable sorted set containing the given elements sorted by their natural ordering.static <E> ImmutableSortedSet<E>of(E e1, E e2, E e3)Deprecated.Pass the parameters of typeComparableto useof(Comparable, Comparable, Comparable).static <E extends Comparable<? super E>>
 ImmutableSortedSet<E>of(E e1, E e2, E e3, E e4)Returns an immutable sorted set containing the given elements sorted by their natural ordering.static <E> ImmutableSortedSet<E>of(E e1, E e2, E e3, E e4)Deprecated.Pass the parameters of typeComparableto useof(Comparable, Comparable, Comparable, Comparable).static <E extends Comparable<? super E>>
 ImmutableSortedSet<E>of(E e1, E e2, E e3, E e4, E e5)Returns an immutable sorted set containing the given elements sorted by their natural ordering.static <E> ImmutableSortedSet<E>of(E e1, E e2, E e3, E e4, E e5)Deprecated.Pass the parameters of typeComparableto useof( Comparable, Comparable, Comparable, Comparable, Comparable).static <E extends Comparable<? super E>>
 ImmutableSortedSet<E>of(E e1, E e2, E e3, E e4, E e5, E e6, E... remaining)Returns an immutable sorted set containing the given elements sorted by their natural ordering.static <E> ImmutableSortedSet<E>of(E e1, E e2, E e3, E e4, E e5, E e6, E... remaining)Deprecated.Pass the parameters of typeComparableto useof(Comparable, Comparable, Comparable, Comparable, Comparable, Comparable, Comparable...).static <E> ImmutableSortedSet.Builder<E>orderedBy(Comparator<E> comparator)Returns a builder that creates immutable sorted sets with an explicit comparator.EpollFirst()Deprecated.Unsupported operation.EpollLast()Deprecated.Unsupported operation.static <E extends Comparable<?>>
 ImmutableSortedSet.Builder<E>reverseOrder()Returns a builder that creates immutable sorted sets whose elements are ordered by the reverse of their natural ordering.Spliterator<E>spliterator()Creates aSpliteratorover the elements in this collection.ImmutableSortedSet<E>subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)Returns a view of the portion of this set whose elements range fromfromElementtotoElement.ImmutableSortedSet<E>subSet(E fromElement, E toElement)Returns a view of the portion of this set whose elements range fromfromElement, inclusive, totoElement, exclusive.ImmutableSortedSet<E>tailSet(E fromElement)Returns a view of the portion of this set whose elements are greater than or equal tofromElement.ImmutableSortedSet<E>tailSet(E fromElement, boolean inclusive)Returns a view of the portion of this set whose elements are greater than (or equal to, ifinclusiveis true)fromElement.static <E> Collector<E,?,ImmutableSet<E>>toImmutableSet()Deprecated.static <E> Collector<E,?,ImmutableSortedSet<E>>toImmutableSortedSet(Comparator<? super E> comparator)Returns aCollectorthat accumulates the input elements into a newImmutableSortedSet, ordered by the specified comparator.- 
Methods inherited from class com.google.common.collect.ImmutableSetequals, hashCode
 - 
Methods inherited from class com.google.common.collect.ImmutableCollectionadd, addAll, clear, contains, remove, removeAll, removeIf, retainAll, toArray, toArray
 - 
Methods inherited from class java.util.AbstractCollectioncontainsAll, isEmpty, size, toString
 - 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface java.util.CollectionparallelStream, removeIf, stream, toArray
 
- 
 
- 
- 
- 
Method Detail- 
toImmutableSortedSetpublic static <E> Collector<E,?,ImmutableSortedSet<E>> toImmutableSortedSet(Comparator<? super E> comparator) Returns aCollectorthat accumulates the input elements into a newImmutableSortedSet, ordered by the specified comparator.If the elements contain duplicates (according to the comparator), only the first duplicate in encounter order will appear in the result. - Since:
- 21.0
 
 - 
ofpublic static <E> ImmutableSortedSet<E> of() Returns the empty immutable sorted set.Performance note: the instance returned is a singleton. - Type Parameters:
- E- the- Set's element type
- Returns:
- an empty Set
 
 - 
ofpublic static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E element) Returns an immutable sorted set containing a single element.- Type Parameters:
- E- the- Set's element type
- Parameters:
- element- the single element
- Returns:
- a Setcontaining the specified element
 
 - 
ofpublic static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E e1, E e2) Returns an immutable sorted set containing the given elements sorted by their natural ordering. When multiple elements are equivalent according toComparable.compareTo(T), only the first one specified is included.- Type Parameters:
- E- the- Set's element type
- Parameters:
- e1- the first element
- e2- the second element
- Returns:
- a Setcontaining the specified elements
- Throws:
- NullPointerException- if any element is null
 
 - 
ofpublic static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E e1, E e2, E e3) Returns an immutable sorted set containing the given elements sorted by their natural ordering. When multiple elements are equivalent according toComparable.compareTo(T), only the first one specified is included.- Type Parameters:
- E- the- Set's element type
- Parameters:
- e1- the first element
- e2- the second element
- e3- the third element
- Returns:
- a Setcontaining the specified elements
- Throws:
- NullPointerException- if any element is null
 
 - 
ofpublic static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4) Returns an immutable sorted set containing the given elements sorted by their natural ordering. When multiple elements are equivalent according toComparable.compareTo(T), only the first one specified is included.- Type Parameters:
- E- the- Set's element type
- Parameters:
- e1- the first element
- e2- the second element
- e3- the third element
- e4- the fourth element
- Returns:
- a Setcontaining the specified elements
- Throws:
- NullPointerException- if any element is null
 
 - 
ofpublic static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4, E e5) Returns an immutable sorted set containing the given elements sorted by their natural ordering. When multiple elements are equivalent according toComparable.compareTo(T), only the first one specified is included.- Type Parameters:
- E- the- Set's element type
- Parameters:
- e1- the first element
- e2- the second element
- e3- the third element
- e4- the fourth element
- e5- the fifth element
- Returns:
- a Setcontaining the specified elements
- Throws:
- NullPointerException- if any element is null
 
 - 
ofpublic static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E... remaining) Returns an immutable sorted set containing the given elements sorted by their natural ordering. When multiple elements are equivalent according toComparable.compareTo(T), only the first one specified is included.- Type Parameters:
- E- the- Set's element type
- Parameters:
- e1- the first element
- e2- the second element
- e3- the third element
- e4- the fourth element
- e5- the fifth element
- e6- the sixth element
- remaining- the seventh element
- Returns:
- a Setcontaining the specified elements
- Throws:
- NullPointerException- if any element is null
- Since:
- 3.0 (source-compatible since 2.0)
 
 - 
copyOfpublic static <E extends Comparable<? super E>> ImmutableSortedSet<E> copyOf(E[] elements) Returns an immutable sorted set containing the given elements sorted by their natural ordering. When multiple elements are equivalent according toComparable.compareTo(T), only the first one specified is included.- Throws:
- NullPointerException- if any of- elementsis null
- Since:
- 3.0
 
 - 
copyOfpublic static <E> ImmutableSortedSet<E> copyOf(Iterable<? extends E> elements) Returns an immutable sorted set containing the given elements sorted by their natural ordering. When multiple elements are equivalent according tocompareTo(), only the first one specified is included. To create a copy of aSortedSetthat preserves the comparator, callcopyOfSorted(java.util.SortedSet<E>)instead. This method iterates overelementsat most once.Note that if sis aSet<String>, thenImmutableSortedSet.copyOf(s)returns anImmutableSortedSet<String>containing each of the strings ins, whileImmutableSortedSet.of(s)returns anImmutableSortedSet<Set<String>>containing one element (the given set itself).Despite the method name, this method attempts to avoid actually copying the data when it is safe to do so. The exact circumstances under which a copy will or will not be performed are undocumented and subject to change. This method is not type-safe, as it may be called on elements that are not mutually comparable. - Throws:
- ClassCastException- if the elements are not mutually comparable
- NullPointerException- if any of- elementsis null
 
 - 
copyOfpublic static <E> ImmutableSortedSet<E> copyOf(Collection<? extends E> elements) Returns an immutable sorted set containing the given elements sorted by their natural ordering. When multiple elements are equivalent according tocompareTo(), only the first one specified is included. To create a copy of aSortedSetthat preserves the comparator, callcopyOfSorted(java.util.SortedSet<E>)instead. This method iterates overelementsat most once.Note that if sis aSet<String>, thenImmutableSortedSet.copyOf(s)returns anImmutableSortedSet<String>containing each of the strings ins, whileImmutableSortedSet.of(s)returns anImmutableSortedSet<Set<String>>containing one element (the given set itself).Note: Despite what the method name suggests, if elementsis anImmutableSortedSet, it may be returned instead of a copy.This method is not type-safe, as it may be called on elements that are not mutually comparable. This method is safe to use even when elementsis a synchronized or concurrent collection that is currently being modified by another thread.- Type Parameters:
- E- the- Set's element type
- Parameters:
- elements- a- Collectionfrom which elements are drawn, must be non-null
- Returns:
- a Setcontaining the elements of the givenCollection
- Throws:
- ClassCastException- if the elements are not mutually comparable
- NullPointerException- if any of- elementsis null
- Since:
- 7.0 (source-compatible since 2.0)
 
 - 
copyOfpublic static <E> ImmutableSortedSet<E> copyOf(Iterator<? extends E> elements) Returns an immutable sorted set containing the given elements sorted by their natural ordering. When multiple elements are equivalent according tocompareTo(), only the first one specified is included.This method is not type-safe, as it may be called on elements that are not mutually comparable. - Throws:
- ClassCastException- if the elements are not mutually comparable
- NullPointerException- if any of- elementsis null
 
 - 
copyOfpublic static <E> ImmutableSortedSet<E> copyOf(Comparator<? super E> comparator, Iterator<? extends E> elements) Returns an immutable sorted set containing the given elements sorted by the givenComparator. When multiple elements are equivalent according tocompareTo(), only the first one specified is included.- Throws:
- NullPointerException- if- comparatoror any of- elementsis null
 
 - 
copyOfpublic static <E> ImmutableSortedSet<E> copyOf(Comparator<? super E> comparator, Iterable<? extends E> elements) Returns an immutable sorted set containing the given elements sorted by the givenComparator. When multiple elements are equivalent according tocompare(), only the first one specified is included. This method iterates overelementsat most once.Despite the method name, this method attempts to avoid actually copying the data when it is safe to do so. The exact circumstances under which a copy will or will not be performed are undocumented and subject to change. - Throws:
- NullPointerException- if- comparatoror any of- elementsis null
 
 - 
copyOfpublic static <E> ImmutableSortedSet<E> copyOf(Comparator<? super E> comparator, Collection<? extends E> elements) Returns an immutable sorted set containing the given elements sorted by the givenComparator. When multiple elements are equivalent according tocompareTo(), only the first one specified is included.Despite the method name, this method attempts to avoid actually copying the data when it is safe to do so. The exact circumstances under which a copy will or will not be performed are undocumented and subject to change. This method is safe to use even when elementsis a synchronized or concurrent collection that is currently being modified by another thread.- Throws:
- NullPointerException- if- comparatoror any of- elementsis null
- Since:
- 7.0 (source-compatible since 2.0)
 
 - 
copyOfSortedpublic static <E> ImmutableSortedSet<E> copyOfSorted(SortedSet<E> sortedSet) Returns an immutable sorted set containing the elements of a sorted set, sorted by the sameComparator. That behavior differs fromcopyOf(Iterable), which always uses the natural ordering of the elements.Despite the method name, this method attempts to avoid actually copying the data when it is safe to do so. The exact circumstances under which a copy will or will not be performed are undocumented and subject to change. This method is safe to use even when sortedSetis a synchronized or concurrent collection that is currently being modified by another thread.- Throws:
- NullPointerException- if- sortedSetor any of its elements is null
 
 - 
orderedBypublic static <E> ImmutableSortedSet.Builder<E> orderedBy(Comparator<E> comparator) Returns a builder that creates immutable sorted sets with an explicit comparator. If the comparator has a more general type than the set being generated, such as creating aSortedSet<Integer>with aComparator<Number>, use theImmutableSortedSet.Builderconstructor instead.- Throws:
- NullPointerException- if- comparatoris null
 
 - 
reverseOrderpublic static <E extends Comparable<?>> ImmutableSortedSet.Builder<E> reverseOrder() Returns a builder that creates immutable sorted sets whose elements are ordered by the reverse of their natural ordering.
 - 
naturalOrderpublic static <E extends Comparable<?>> ImmutableSortedSet.Builder<E> naturalOrder() Returns a builder that creates immutable sorted sets whose elements are ordered by their natural ordering. The sorted sets useOrdering.natural()as the comparator. This method provides more type-safety thanbuilder(), as it can be called only for classes that implementComparable.
 - 
comparatorpublic Comparator<? super E> comparator() Returns the comparator that orders the elements, which isOrdering.natural()when the natural ordering of the elements is used. Note that its behavior is not consistent withSortedSet.comparator(), which returnsnullto indicate natural ordering.- Specified by:
- comparatorin interface- SortedSet<E>
- Returns:
- the comparator used to order the elements in this set,
         or nullif this set uses the natural ordering of its elements
 
 - 
iteratorpublic abstract UnmodifiableIterator<E> iterator() Description copied from class:ImmutableCollectionReturns an unmodifiable iterator across the elements in this collection.- Specified by:
- iteratorin interface- Collection<E>
- Specified by:
- iteratorin interface- Iterable<E>
- Specified by:
- iteratorin interface- NavigableSet<E>
- Specified by:
- iteratorin interface- Set<E>
- Specified by:
- iteratorin class- ImmutableSet<E>
- Returns:
- an iterator over the elements contained in this collection
 
 - 
headSetpublic ImmutableSortedSet<E> headSet(E toElement) Returns a view of the portion of this set whose elements are strictly less thantoElement. The returned set is backed by this set, so changes in the returned set are reflected in this set, and vice-versa. The returned set supports all optional set operations that this set supports.The returned set will throw an IllegalArgumentExceptionon an attempt to insert an element outside its range.Equivalent to headSet(toElement, false).This method returns a serializable ImmutableSortedSet.The SortedSet.headSet(E)documentation states that a subset of a subset throws anIllegalArgumentExceptionif passed atoElementgreater than an earliertoElement. However, this method doesn't throw an exception in that situation, but instead keeps the originaltoElement.
 - 
headSetpublic ImmutableSortedSet<E> headSet(E toElement, boolean inclusive) Description copied from interface:java.util.NavigableSetReturns a view of the portion of this set whose elements are less than (or equal to, ifinclusiveis true)toElement. The returned set is backed by this set, so changes in the returned set are reflected in this set, and vice-versa. The returned set supports all optional set operations that this set supports.The returned set will throw an IllegalArgumentExceptionon an attempt to insert an element outside its range.- Specified by:
- headSetin interface- NavigableSet<E>
- Parameters:
- toElement- high endpoint of the returned set
- inclusive-- trueif 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 inclusiveis true)toElement
- Since:
- 12.0
 
 - 
subSetpublic ImmutableSortedSet<E> subSet(E fromElement, E toElement) Returns a view of the portion of this set whose elements range fromfromElement, inclusive, totoElement, exclusive. (IffromElementandtoElementare equal, the returned set is empty.) The returned set is backed by this set, so changes in the returned set are reflected in this set, and vice-versa. The returned set supports all optional set operations that this set supports.The returned set will throw an IllegalArgumentExceptionon an attempt to insert an element outside its range.Equivalent to subSet(fromElement, true, toElement, false).This method returns a serializable ImmutableSortedSet.The SortedSet.subSet(E, E)documentation states that a subset of a subset throws anIllegalArgumentExceptionif passed afromElementsmaller than an earlierfromElement. However, this method doesn't throw an exception in that situation, but instead keeps the originalfromElement. Similarly, this method keeps the originaltoElement, instead of throwing an exception, if passed atoElementgreater than an earliertoElement.- Specified by:
- subSetin interface- NavigableSet<E>
- Specified by:
- subSetin interface- SortedSet<E>
- 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, totoElement, exclusive
 
 - 
subSet@GwtIncompatible public ImmutableSortedSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) Description copied from interface:java.util.NavigableSetReturns a view of the portion of this set whose elements range fromfromElementtotoElement. IffromElementandtoElementare equal, the returned set is empty unlessfromInclusiveandtoInclusiveare both true. The returned set is backed by this set, so changes in the returned set are reflected in this set, and vice-versa. The returned set supports all optional set operations that this set supports.The returned set will throw an IllegalArgumentExceptionon an attempt to insert an element outside its range.- Specified by:
- subSetin interface- NavigableSet<E>
- Parameters:
- fromElement- low endpoint of the returned set
- fromInclusive-- trueif the low endpoint is to be included in the returned view
- toElement- high endpoint of the returned set
- toInclusive-- trueif 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
- Since:
- 12.0
 
 - 
tailSetpublic ImmutableSortedSet<E> tailSet(E fromElement) Returns a view of the portion of this set whose elements are greater than or equal tofromElement. The returned set is backed by this set, so changes in the returned set are reflected in this set, and vice-versa. The returned set supports all optional set operations that this set supports.The returned set will throw an IllegalArgumentExceptionon an attempt to insert an element outside its range.Equivalent to tailSet(fromElement, true).This method returns a serializable ImmutableSortedSet.The SortedSet.tailSet(E)documentation states that a subset of a subset throws anIllegalArgumentExceptionif passed afromElementsmaller than an earlierfromElement. However, this method doesn't throw an exception in that situation, but instead keeps the originalfromElement.
 - 
tailSetpublic ImmutableSortedSet<E> tailSet(E fromElement, boolean inclusive) Description copied from interface:java.util.NavigableSetReturns a view of the portion of this set whose elements are greater than (or equal to, ifinclusiveis true)fromElement. The returned set is backed by this set, so changes in the returned set are reflected in this set, and vice-versa. The returned set supports all optional set operations that this set supports.The returned set will throw an IllegalArgumentExceptionon an attempt to insert an element outside its range.- Specified by:
- tailSetin interface- NavigableSet<E>
- Parameters:
- fromElement- low endpoint of the returned set
- inclusive-- trueif 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
- Since:
- 12.0
 
 - 
lower@GwtIncompatible @CheckForNull public E lower(E e) Description copied from interface:java.util.NavigableSetReturns the greatest element in this set strictly less than the given element, ornullif there is no such element.- Specified by:
- lowerin interface- NavigableSet<E>
- Parameters:
- e- the value to match
- Returns:
- the greatest element less than e, ornullif there is no such element
- Since:
- 12.0
 
 - 
floor@CheckForNull public E floor(E e) Description copied from interface:java.util.NavigableSetReturns the greatest element in this set less than or equal to the given element, ornullif there is no such element.- Specified by:
- floorin interface- NavigableSet<E>
- Parameters:
- e- the value to match
- Returns:
- the greatest element less than or equal to e, ornullif there is no such element
- Since:
- 12.0
 
 - 
ceiling@CheckForNull public E ceiling(E e) Description copied from interface:java.util.NavigableSetReturns the least element in this set greater than or equal to the given element, ornullif there is no such element.- Specified by:
- ceilingin interface- NavigableSet<E>
- Parameters:
- e- the value to match
- Returns:
- the least element greater than or equal to e, ornullif there is no such element
- Since:
- 12.0
 
 - 
higher@GwtIncompatible @CheckForNull public E higher(E e) Description copied from interface:java.util.NavigableSetReturns the least element in this set strictly greater than the given element, ornullif there is no such element.- Specified by:
- higherin interface- NavigableSet<E>
- Parameters:
- e- the value to match
- Returns:
- the least element greater than e, ornullif there is no such element
- Since:
- 12.0
 
 - 
firstpublic E first() Description copied from interface:java.util.SortedSetReturns the first (lowest) element currently in this set.
 - 
lastpublic E last() Description copied from interface:java.util.SortedSetReturns the last (highest) element currently in this set.
 - 
pollFirst@CanIgnoreReturnValue @Deprecated @GwtIncompatible @CheckForNull public final E pollFirst() Deprecated.Unsupported operation.Guaranteed to throw an exception and leave the set unmodified.- Specified by:
- pollFirstin interface- NavigableSet<E>
- Returns:
- the first element, or nullif this set is empty
- Throws:
- UnsupportedOperationException- always
- Since:
- 12.0
 
 - 
pollLast@CanIgnoreReturnValue @Deprecated @GwtIncompatible @CheckForNull public final E pollLast() Deprecated.Unsupported operation.Guaranteed to throw an exception and leave the set unmodified.- Specified by:
- pollLastin interface- NavigableSet<E>
- Returns:
- the last element, or nullif this set is empty
- Throws:
- UnsupportedOperationException- always
- Since:
- 12.0
 
 - 
descendingSet@GwtIncompatible public ImmutableSortedSet<E> descendingSet() Description copied from interface:java.util.NavigableSetReturns a reverse order view of the elements contained in this set. The descending set is backed by this set, so changes to the set are reflected in the descending set, and vice-versa. If either set is modified while an iteration over either set is in progress (except through the iterator's ownremoveoperation), the results of the iteration are undefined.The returned set has an ordering equivalent to Collections.reverseOrder(comparator()). The expressions.descendingSet().descendingSet()returns a view ofsessentially equivalent tos.- Specified by:
- descendingSetin interface- NavigableSet<E>
- Returns:
- a reverse order view of this set
- Since:
- 12.0
 
 - 
spliteratorpublic Spliterator<E> spliterator() Description copied from interface:java.util.CollectionCreates aSpliteratorover the elements in this collection. Implementations should document characteristic values reported by the spliterator. Such characteristic values are not required to be reported if the spliterator reportsSpliterator.SIZEDand this collection contains no elements.The default implementation should be overridden by subclasses that can return a more efficient spliterator. In order to preserve expected laziness behavior for the Collection.stream()andCollection.parallelStream()methods, spliterators should either have the characteristic ofIMMUTABLEorCONCURRENT, or be late-binding. If none of these is practical, the overriding class should describe the spliterator's documented policy of binding and structural interference, and should override theCollection.stream()andCollection.parallelStream()methods to create streams using aSupplierof the spliterator, as in:Stream<E> s = StreamSupport.stream(() -> spliterator(), spliteratorCharacteristics)These requirements ensure that streams produced by the Collection.stream()andCollection.parallelStream()methods will reflect the contents of the collection as of initiation of the terminal stream operation.- Specified by:
- spliteratorin interface- Collection<E>
- Specified by:
- spliteratorin interface- Iterable<E>
- Specified by:
- spliteratorin interface- Set<E>
- Specified by:
- spliteratorin interface- SortedSet<E>
- Overrides:
- spliteratorin class- ImmutableCollection<E>
- Returns:
- a Spliteratorover the elements in this collection
 
 - 
descendingIterator@GwtIncompatible public abstract UnmodifiableIterator<E> descendingIterator() Description copied from interface:java.util.NavigableSetReturns an iterator over the elements in this set, in descending order. Equivalent in effect todescendingSet().iterator().- Specified by:
- descendingIteratorin interface- NavigableSet<E>
- Returns:
- an iterator over the elements in this set, in descending order
- Since:
- 12.0
 
 - 
toImmutableSet@Deprecated public static <E> Collector<E,?,ImmutableSet<E>> toImmutableSet() Deprecated.Not supported. UsetoImmutableSortedSet(java.util.Comparator<? super E>)instead. This method exists only to hideImmutableSet.toImmutableSet()from consumers ofImmutableSortedSet.- Throws:
- UnsupportedOperationException- always
- Since:
- 21.0
 
 - 
builder@Deprecated public static <E> ImmutableSortedSet.Builder<E> builder() Deprecated.UsenaturalOrder(), which offers better type-safety.Not supported. UsenaturalOrder(), which offers better type-safety, instead. This method exists only to hideImmutableSet.builder()from consumers ofImmutableSortedSet.- Throws:
- UnsupportedOperationException- always
 
 - 
builderWithExpectedSize@Deprecated public static <E> ImmutableSortedSet.Builder<E> builderWithExpectedSize(int expectedSize) Deprecated.Not supported by ImmutableSortedSet.Not supported. This method exists only to hideImmutableSet.builderWithExpectedSize(int)from consumers ofImmutableSortedSet.- Throws:
- UnsupportedOperationException- always
 
 - 
of@Deprecated public static <E> ImmutableSortedSet<E> of(E element) Deprecated.Pass a parameter of typeComparableto useof(Comparable).Not supported. You are attempting to create a set that may contain a non-Comparableelement. Proper calls will resolve to the version inImmutableSortedSet, not this dummy version.- Type Parameters:
- E- the- Set's element type
- Parameters:
- element- the single element
- Returns:
- a Setcontaining the specified element
- Throws:
- UnsupportedOperationException- always
 
 - 
of@Deprecated public static <E> ImmutableSortedSet<E> of(E e1, E e2) Deprecated.Pass the parameters of typeComparableto useof(Comparable, Comparable).Not supported. You are attempting to create a set that may contain a non-Comparableelement. Proper calls will resolve to the version inImmutableSortedSet, not this dummy version.- Type Parameters:
- E- the- Set's element type
- Parameters:
- e1- the first element
- e2- the second element
- Returns:
- a Setcontaining the specified elements
- Throws:
- UnsupportedOperationException- always
 
 - 
of@Deprecated public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3) Deprecated.Pass the parameters of typeComparableto useof(Comparable, Comparable, Comparable).Not supported. You are attempting to create a set that may contain a non-Comparableelement. Proper calls will resolve to the version inImmutableSortedSet, not this dummy version.- Type Parameters:
- E- the- Set's element type
- Parameters:
- e1- the first element
- e2- the second element
- e3- the third element
- Returns:
- a Setcontaining the specified elements
- Throws:
- UnsupportedOperationException- always
 
 - 
of@Deprecated public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4) Deprecated.Pass the parameters of typeComparableto useof(Comparable, Comparable, Comparable, Comparable).Not supported. You are attempting to create a set that may contain a non-Comparableelement. Proper calls will resolve to the version inImmutableSortedSet, not this dummy version.- Type Parameters:
- E- the- Set's element type
- Parameters:
- e1- the first element
- e2- the second element
- e3- the third element
- e4- the fourth element
- Returns:
- a Setcontaining the specified elements
- Throws:
- UnsupportedOperationException- always
 
 - 
of@Deprecated public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4, E e5) Deprecated.Pass the parameters of typeComparableto useof( Comparable, Comparable, Comparable, Comparable, Comparable).Not supported. You are attempting to create a set that may contain a non-Comparableelement. Proper calls will resolve to the version inImmutableSortedSet, not this dummy version.- Type Parameters:
- E- the- Set's element type
- Parameters:
- e1- the first element
- e2- the second element
- e3- the third element
- e4- the fourth element
- e5- the fifth element
- Returns:
- a Setcontaining the specified elements
- Throws:
- UnsupportedOperationException- always
 
 - 
of@Deprecated public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E... remaining) Deprecated.Pass the parameters of typeComparableto useof(Comparable, Comparable, Comparable, Comparable, Comparable, Comparable, Comparable...).Not supported. You are attempting to create a set that may contain a non-Comparableelement. Proper calls will resolve to the version inImmutableSortedSet, not this dummy version.- Type Parameters:
- E- the- Set's element type
- Parameters:
- e1- the first element
- e2- the second element
- e3- the third element
- e4- the fourth element
- e5- the fifth element
- e6- the sixth element
- remaining- the seventh element
- Returns:
- a Setcontaining the specified elements
- Throws:
- UnsupportedOperationException- always
 
 - 
copyOf@Deprecated public static <E> ImmutableSortedSet<E> copyOf(E[] elements) Deprecated.Pass parameters of typeComparableto usecopyOf(Comparable[]).Not supported. You are attempting to create a set that may contain non-Comparableelements. Proper calls will resolve to the version inImmutableSortedSet, not this dummy version.- Throws:
- UnsupportedOperationException- always
 
 - 
asListpublic ImmutableList<E> asList() Description copied from class:ImmutableCollectionReturns anImmutableListcontaining the same elements, in the same order, as this collection.Performance note: in most cases this method can return quickly without actually copying anything. The exact circumstances under which the copy is performed are undefined and subject to change. - Overrides:
- asListin class- ImmutableCollection<E>
 
 
- 
 
-