abstract class ImmutableSortedSetFauxverideShim<E> extends ImmutableSet.CachingAsList<E>
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.
ImmutableSet.Builder<E>, ImmutableSet.CachingAsList<E>, ImmutableSet.Indexed<E>
MAX_TABLE_SIZE, SPLITERATOR_CHARACTERISTICS
Constructor and Description |
---|
ImmutableSortedSetFauxverideShim() |
Modifier and Type | Method and Description |
---|---|
static <E> ImmutableSortedSet.Builder<E> |
builder()
Deprecated.
Use
ImmutableSortedSet.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 type
Comparable to use ImmutableSortedSet.copyOf(Comparable[]) . |
static <E> ImmutableSortedSet<E> |
of(E element)
Deprecated.
Pass a parameter of type
Comparable to use ImmutableSortedSet.of(Comparable) . |
static <E> ImmutableSortedSet<E> |
of(E e1,
E e2)
Deprecated.
Pass the parameters of type
Comparable to use ImmutableSortedSet.of(Comparable, Comparable) . |
static <E> ImmutableSortedSet<E> |
of(E e1,
E e2,
E e3)
Deprecated.
Pass the parameters of type
Comparable to use ImmutableSortedSet.of(Comparable, Comparable, Comparable) . |
static <E> ImmutableSortedSet<E> |
of(E e1,
E e2,
E e3,
E e4)
Deprecated.
Pass the parameters of type
Comparable to use ImmutableSortedSet.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 type
Comparable to use ImmutableSortedSet.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 type
Comparable to use ImmutableSortedSet.of(Comparable, Comparable, Comparable, Comparable, Comparable,
Comparable, Comparable...) . |
static <E> java.util.stream.Collector<E,?,ImmutableSet<E>> |
toImmutableSet()
|
asList, createAsList
chooseTableSize, copyOf, copyOf, copyOf, equals, hashCode, isHashCodeFast, iterator, of, writeReplace
add, addAll, clear, contains, copyIntoArray, internalArray, internalArrayEnd, internalArrayStart, isPartialView, remove, removeAll, removeIf, retainAll, spliterator, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
@Deprecated public static <E> java.util.stream.Collector<E,?,ImmutableSet<E>> toImmutableSet()
ImmutableSortedSet.toImmutableSortedSet(java.util.Comparator<? super E>)
instead. This method exists
only to hide ImmutableSet.toImmutableSet()
from consumers of ImmutableSortedSet
.java.lang.UnsupportedOperationException
- always@Deprecated public static <E> ImmutableSortedSet.Builder<E> builder()
ImmutableSortedSet.naturalOrder()
, which offers better type-safety.ImmutableSortedSet.naturalOrder()
, which offers better type-safety,
instead. This method exists only to hide ImmutableSet.builder()
from consumers of ImmutableSortedSet
.java.lang.UnsupportedOperationException
- always@Deprecated public static <E> ImmutableSortedSet.Builder<E> builderWithExpectedSize(int expectedSize)
ImmutableSet.builderWithExpectedSize(int)
from consumers of ImmutableSortedSet
.java.lang.UnsupportedOperationException
- always@Deprecated public static <E> ImmutableSortedSet<E> of(E element)
Comparable
to use ImmutableSortedSet.of(Comparable)
.Comparable
element. Proper calls will resolve to the version in ImmutableSortedSet
, not this
dummy version.java.lang.UnsupportedOperationException
- always@Deprecated public static <E> ImmutableSortedSet<E> of(E e1, E e2)
Comparable
to use ImmutableSortedSet.of(Comparable, Comparable)
.Comparable
element. Proper calls will resolve to the version in ImmutableSortedSet
, not this
dummy version.java.lang.UnsupportedOperationException
- always@Deprecated public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3)
Comparable
to use ImmutableSortedSet.of(Comparable, Comparable, Comparable)
.Comparable
element. Proper calls will resolve to the version in ImmutableSortedSet
, not this
dummy version.java.lang.UnsupportedOperationException
- always@Deprecated public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4)
Comparable
to use ImmutableSortedSet.of(Comparable, Comparable, Comparable, Comparable)
. Comparable
element. Proper calls will resolve to the version in ImmutableSortedSet
, not this
dummy version.java.lang.UnsupportedOperationException
- always@Deprecated public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4, E e5)
Comparable
to use ImmutableSortedSet.of( Comparable, Comparable, Comparable, Comparable, Comparable)
. Comparable
element. Proper calls will resolve to the version in ImmutableSortedSet
, not this
dummy version.java.lang.UnsupportedOperationException
- always@Deprecated public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E... remaining)
Comparable
to use ImmutableSortedSet.of(Comparable, Comparable, Comparable, Comparable, Comparable,
Comparable, Comparable...)
. Comparable
element. Proper calls will resolve to the version in ImmutableSortedSet
, not this
dummy version.java.lang.UnsupportedOperationException
- always@Deprecated public static <E> ImmutableSortedSet<E> copyOf(E[] elements)
Comparable
to use ImmutableSortedSet.copyOf(Comparable[])
.Comparable
elements. Proper calls will resolve to the version in ImmutableSortedSet
, not this
dummy version.java.lang.UnsupportedOperationException
- always