Package com.google.common.collect
Class ImmutableSortedSetFauxverideShim<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- com.google.common.collect.ImmutableCollection<E>
-
- com.google.common.collect.ImmutableSet<E>
-
- com.google.common.collect.ImmutableSortedSetFauxverideShim<E>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.Set<E>
- Direct Known Subclasses:
ImmutableSortedSet
@GwtIncompatible abstract class ImmutableSortedSetFauxverideShim<E> extends ImmutableSet<E>
"Overrides" theImmutableSet
static methods that lackImmutableSortedSet
equivalents with deprecated, exception-throwing versions. This prevents accidents like the following:List<Object> objects = ...; // Sort them: Set<Object> sorted = ImmutableSortedSet.copyOf(objects); // BAD CODE! The returned set is actually an unsorted ImmutableSet!
While we could put the overrides in
ImmutableSortedSet
itself, it seems clearer to separate these "do not call" methods from those intended for normal use.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableSet
ImmutableSet.Builder<E>, ImmutableSet.Indexed<E>
-
-
Field Summary
-
Fields inherited from class com.google.common.collect.ImmutableSet
HASH_FLOODING_FPP, MAX_RUN_MULTIPLIER, MAX_TABLE_SIZE, SPLITERATOR_CHARACTERISTICS
-
-
Constructor Summary
Constructors Constructor Description ImmutableSortedSetFauxverideShim()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <E> ImmutableSortedSet.Builder<E>
builder()
Deprecated.UseImmutableSortedSet.naturalOrder()
, which offers better type-safety.static <E> ImmutableSortedSet.Builder<E>
builderWithExpectedSize(int expectedSize)
Deprecated.Not supported by ImmutableSortedSet.static <E> ImmutableSortedSet<E>
copyOf(E[] elements)
Deprecated.Pass parameters of typeComparable
to useImmutableSortedSet.copyOf(Comparable[])
.static <E> ImmutableSortedSet<E>
of(E element)
Deprecated.Pass a parameter of typeComparable
to useImmutableSortedSet.of(Comparable)
.static <E> ImmutableSortedSet<E>
of(E e1, E e2)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedSet.of(Comparable, Comparable)
.static <E> ImmutableSortedSet<E>
of(E e1, E e2, E e3)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedSet.of(Comparable, Comparable, Comparable)
.static <E> ImmutableSortedSet<E>
of(E e1, E e2, E e3, E e4)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedSet.of(Comparable, Comparable, Comparable, Comparable)
.static <E> ImmutableSortedSet<E>
of(E e1, E e2, E e3, E e4, E e5)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedSet.of( Comparable, Comparable, Comparable, Comparable, Comparable)
.static <E> ImmutableSortedSet<E>
of(E e1, E e2, E e3, E e4, E e5, E e6, E... remaining)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedSet.of(Comparable, Comparable, Comparable, Comparable, Comparable, Comparable, Comparable...)
.static <E> java.util.stream.Collector<E,?,ImmutableSet<E>>
toImmutableSet()
-
Methods inherited from class com.google.common.collect.ImmutableSet
asList, chooseTableSize, copyOf, copyOf, copyOf, createAsList, equals, hashCode, hashFloodingDetected, isHashCodeFast, iterator, of, rebuildHashTable, writeReplace
-
Methods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, contains, copyIntoArray, internalArray, internalArrayEnd, internalArrayStart, isPartialView, remove, removeAll, removeIf, retainAll, spliterator, toArray, toArray
-
-
-
-
Method Detail
-
toImmutableSet
@Deprecated public static <E> java.util.stream.Collector<E,?,ImmutableSet<E>> toImmutableSet()
Not supported. UseImmutableSortedSet.toImmutableSortedSet(java.util.Comparator<? super E>)
instead. This method exists only to hideImmutableSet.toImmutableSet()
from consumers ofImmutableSortedSet
.- Throws:
java.lang.UnsupportedOperationException
- always- Since:
- 21.0
-
builder
@Deprecated public static <E> ImmutableSortedSet.Builder<E> builder()
Deprecated.UseImmutableSortedSet.naturalOrder()
, which offers better type-safety.Not supported. UseImmutableSortedSet.naturalOrder()
, which offers better type-safety, instead. This method exists only to hideImmutableSet.builder()
from consumers ofImmutableSortedSet
.- Throws:
java.lang.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:
java.lang.UnsupportedOperationException
- always
-
of
@Deprecated public static <E> ImmutableSortedSet<E> of(E element)
Deprecated.Pass a parameter of typeComparable
to useImmutableSortedSet.of(Comparable)
.Not supported. You are attempting to create a set that may contain a non-Comparable
element. Proper calls will resolve to the version inImmutableSortedSet
, not this dummy version.- Throws:
java.lang.UnsupportedOperationException
- always
-
of
@Deprecated public static <E> ImmutableSortedSet<E> of(E e1, E e2)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedSet.of(Comparable, Comparable)
.Not supported. You are attempting to create a set that may contain a non-Comparable
element. Proper calls will resolve to the version inImmutableSortedSet
, not this dummy version.- Throws:
java.lang.UnsupportedOperationException
- always
-
of
@Deprecated public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedSet.of(Comparable, Comparable, Comparable)
.Not supported. You are attempting to create a set that may contain a non-Comparable
element. Proper calls will resolve to the version inImmutableSortedSet
, not this dummy version.- Throws:
java.lang.UnsupportedOperationException
- always
-
of
@Deprecated public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedSet.of(Comparable, Comparable, Comparable, Comparable)
.Not supported. You are attempting to create a set that may contain a non-Comparable
element. Proper calls will resolve to the version inImmutableSortedSet
, not this dummy version.- Throws:
java.lang.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 typeComparable
to useImmutableSortedSet.of( Comparable, Comparable, Comparable, Comparable, Comparable)
.Not supported. You are attempting to create a set that may contain a non-Comparable
element. Proper calls will resolve to the version inImmutableSortedSet
, not this dummy version.- Throws:
java.lang.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 typeComparable
to useImmutableSortedSet.of(Comparable, Comparable, Comparable, Comparable, Comparable, Comparable, Comparable...)
.Not supported. You are attempting to create a set that may contain a non-Comparable
element. Proper calls will resolve to the version inImmutableSortedSet
, not this dummy version.- Throws:
java.lang.UnsupportedOperationException
- always
-
copyOf
@Deprecated public static <E> ImmutableSortedSet<E> copyOf(E[] elements)
Deprecated.Pass parameters of typeComparable
to useImmutableSortedSet.copyOf(Comparable[])
.Not supported. You are attempting to create a set that may contain non-Comparable
elements. Proper calls will resolve to the version inImmutableSortedSet
, not this dummy version.- Throws:
java.lang.UnsupportedOperationException
- always
-
-