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.ImmutableSet.CachingAsList<E>
com.google.common.collect.ImmutableSortedSetFauxverideShim<E>
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,Set<E>
- Direct Known Subclasses:
ImmutableSortedSet
"Overrides" the
ImmutableSet static methods that lack ImmutableSortedSet
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.CachingAsList<E>, ImmutableSet.Indexed<E> -
Field Summary
Fields inherited from class com.google.common.collect.ImmutableSet
MAX_TABLE_SIZE, SPLITERATOR_CHARACTERISTICS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> ImmutableSortedSet.Builder<E>builder()Deprecated.static <E> ImmutableSortedSet.Builder<E>builderWithExpectedSize(int expectedSize) Deprecated.Not supported by ImmutableSortedSet.static <E> ImmutableSortedSet<E>copyOf(E[] elements) Deprecated.Pass parameters of typeComparableto useImmutableSortedSet.copyOf(Comparable[]).static <E> ImmutableSortedSet<E>of(E element) Deprecated.Pass a parameter of typeComparableto useImmutableSortedSet.of(Comparable).static <E> ImmutableSortedSet<E>of(E e1, E e2) Deprecated.Pass the parameters of typeComparableto useImmutableSortedSet.of(Comparable, Comparable).static <E> ImmutableSortedSet<E>of(E e1, E e2, E e3) Deprecated.Pass the parameters of typeComparableto useImmutableSortedSet.of(Comparable, Comparable, Comparable).static <E> ImmutableSortedSet<E>of(E e1, E e2, E e3, E e4) Deprecated.Pass the parameters of typeComparableto 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 typeComparableto 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 typeComparableto useImmutableSortedSet.of(Comparable, Comparable, Comparable, Comparable, Comparable, Comparable, Comparable...).static <E> Collector<E,?, ImmutableSet<E>> Methods inherited from class com.google.common.collect.ImmutableSet.CachingAsList
asList, createAsListMethods inherited from class com.google.common.collect.ImmutableSet
chooseTableSize, copyOf, copyOf, copyOf, equals, hashCode, isHashCodeFast, iterator, of, writeReplaceMethods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, contains, copyIntoArray, internalArray, internalArrayEnd, internalArrayStart, isPartialView, remove, removeAll, removeIf, retainAll, spliterator, toArray, toArrayMethods inherited from class java.util.AbstractCollection
containsAll, isEmpty, size, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Constructor Details
-
ImmutableSortedSetFauxverideShim
ImmutableSortedSetFauxverideShim()
-
-
Method Details
-
toImmutableSet
Not supported. UseImmutableSortedSet.toImmutableSortedSet(java.util.Comparator<? super E>)instead. This method exists only to hideImmutableSet.toImmutableSet()from consumers ofImmutableSortedSet.- Throws:
UnsupportedOperationException- always- Since:
- 21.0
-
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:
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.Pass a parameter of typeComparableto useImmutableSortedSet.of(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.- Throws:
UnsupportedOperationException- always
-
of
Deprecated.Pass the parameters of typeComparableto useImmutableSortedSet.of(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.- Throws:
UnsupportedOperationException- always
-
of
Deprecated.Pass the parameters of typeComparableto useImmutableSortedSet.of(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.- Throws:
UnsupportedOperationException- always
-
of
Deprecated.Pass the parameters of typeComparableto useImmutableSortedSet.of(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.- Throws:
UnsupportedOperationException- always
-
of
Deprecated.Pass the parameters of typeComparableto useImmutableSortedSet.of(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.- 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 useImmutableSortedSet.of(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.- Throws:
UnsupportedOperationException- always
-
copyOf
Deprecated.Pass parameters of typeComparableto useImmutableSortedSet.copyOf(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
-
ImmutableSortedSet.naturalOrder(), which offers better type-safety.