Top Description Constructors Methods
com.google.common.collect

pack-priv abstract Class ImmutableSortedSetFauxverideShim<E>

extends ImmutableSet.CachingAsList<E>
Class Inheritance
Known Direct Subclasses
com.google.common.collect.ImmutableSortedSet
Annotations
@GwtIncompatible
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtIncompatible, com.google.errorprone.annotations.DoNotCall, java.util.stream.Collector

"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.

Author
Chris Povirk

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public static <E> ImmutableSortedSet.Builder<E>
builder()

Hides com.google.common.collect.ImmutableSet.builder.

Deprecated Use ImmutableSortedSet#naturalOrder, which offers better type-safety.
Not supported.
public static <E> ImmutableSortedSet.Builder<E>
builderWithExpectedSize(int expectedSize)

Hides com.google.common.collect.ImmutableSet.builderWithExpectedSize.

Deprecated Not supported by ImmutableSortedSet.
Not supported.
public static <E> ImmutableSortedSet<E>
copyOf(E[] elements)

Hides com.google.common.collect.ImmutableSet.copyOf.

Deprecated Pass parameters of type Comparable to use ImmutableSortedSet#copyOf(Comparable[]).
Not supported.
public static <E> ImmutableSortedSet<E>
of(E
the single element
element
)

Hides com.google.common.collect.ImmutableSet.of, java.util.Set.of.

Deprecated Pass a parameter of type Comparable to use ImmutableSortedSet#of(Comparable).
Not supported.
public static <E> ImmutableSortedSet<E>
of(E
the first element
e1
,
E
the second element
e2
)

Hides com.google.common.collect.ImmutableSet.of, java.util.Set.of.

Deprecated Pass the parameters of type Comparable to use ImmutableSortedSet#of(Comparable, Comparable).
Not supported.
public static <E> ImmutableSortedSet<E>
of(E
the first element
e1
,
E
the second element
e2
,
E
the third element
e3
)

Hides com.google.common.collect.ImmutableSet.of, java.util.Set.of.

Deprecated Pass the parameters of type Comparable to use ImmutableSortedSet#of(Comparable, Comparable, Comparable).
Not supported.
public static <E> ImmutableSortedSet<E>
of(E
the first element
e1
,
E
the second element
e2
,
E
the third element
e3
,
E
the fourth element
e4
)

Hides com.google.common.collect.ImmutableSet.of, java.util.Set.of.

Deprecated Pass the parameters of type Comparable to use ImmutableSortedSet#of(Comparable, Comparable, Comparable, Comparable).
Not supported.
public static <E> ImmutableSortedSet<E>
of(E
the first element
e1
,
E
the second element
e2
,
E
the third element
e3
,
E
the fourth element
e4
,
E
the fifth element
e5
)

Hides com.google.common.collect.ImmutableSet.of, java.util.Set.of.

Deprecated Pass the parameters of type Comparable to use ImmutableSortedSet#of(Comparable, Comparable, Comparable, Comparable, Comparable).
Not supported.
public static <E> ImmutableSortedSet<E>
of(E
the first element
e1
,
E
the second element
e2
,
E
the third element
e3
,
E
the fourth element
e4
,
E
the fifth element
e5
,
E
the sixth element
e6
,
E...
the seventh element
remaining
)

Hides com.google.common.collect.ImmutableSet.of, java.util.Set.of.

Not supported.
public static <E> Collector<E, ?, ImmutableSet<E>>
Inherited from com.google.common.collect.ImmutableSet.CachingAsList:
asListcreateAsList

Constructor Detail

ImmutableSortedSetFauxverideShimback to summary
pack-priv ImmutableSortedSetFauxverideShim()

Method Detail

builderback to summary
public static <E> ImmutableSortedSet.Builder<E> builder()

Hides com.google.common.collect.ImmutableSet.builder.

Deprecated

Use ImmutableSortedSet#naturalOrder, which offers better type-safety.

Not supported. Use ImmutableSortedSet#naturalOrder, which offers better type-safety, instead. This method exists only to hide ImmutableSet#builder from consumers of ImmutableSortedSet.

Annotations
@DoNotCall:Use naturalOrder
@Deprecated
Exceptions
UnsupportedOperationException:
always
builderWithExpectedSizeback to summary
public static <E> ImmutableSortedSet.Builder<E> builderWithExpectedSize(int expectedSize)

Hides com.google.common.collect.ImmutableSet.builderWithExpectedSize.

Deprecated

Not supported by ImmutableSortedSet.

Not supported. This method exists only to hide ImmutableSet#builderWithExpectedSize from consumers of ImmutableSortedSet.

Annotations
@DoNotCall:Use naturalOrder (which does not accept an expected size)
@Deprecated
Exceptions
UnsupportedOperationException:
always
copyOfback to summary
public static <E> ImmutableSortedSet<E> copyOf(E[] elements)

Hides com.google.common.collect.ImmutableSet.copyOf.

Deprecated

Pass parameters of type Comparable to use ImmutableSortedSet#copyOf(Comparable[]).

Not supported. You are attempting to create a set that may contain non-Comparable elements. Proper calls will resolve to the version in ImmutableSortedSet, not this dummy version.

Annotations
@DoNotCall:Pass parameters of type Comparable
@Deprecated
Exceptions
UnsupportedOperationException:
always
ofback to summary
public static <E> ImmutableSortedSet<E> of(E element)

Hides com.google.common.collect.ImmutableSet.of, java.util.Set.of.

Deprecated

Pass a parameter of type Comparable to use ImmutableSortedSet#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 in ImmutableSortedSet, not this dummy version.

Parameters
<E>

Doc from java.util.Set.of. the Set's element type

element:E

Doc from java.util.Set.of.

the single element

Returns:ImmutableSortedSet<E>

Doc from java.util.Set.of.

a Set containing the specified element

Annotations
@DoNotCall:Pass a parameter of type Comparable
@Deprecated
Exceptions
UnsupportedOperationException:
always
ofback to summary
public static <E> ImmutableSortedSet<E> of(E e1, E e2)

Hides com.google.common.collect.ImmutableSet.of, java.util.Set.of.

Deprecated

Pass the parameters of type Comparable to use ImmutableSortedSet#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 in ImmutableSortedSet, not this dummy version.

Parameters
<E>

Doc from java.util.Set.of. the Set's element type

e1:E

Doc from java.util.Set.of.

the first element

e2:E

Doc from java.util.Set.of.

the second element

Returns:ImmutableSortedSet<E>

Doc from java.util.Set.of.

a Set containing the specified elements

Annotations
@DoNotCall:Pass parameters of type Comparable
@Deprecated
Exceptions
UnsupportedOperationException:
always
ofback to summary
public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3)

Hides com.google.common.collect.ImmutableSet.of, java.util.Set.of.

Deprecated

Pass the parameters of type Comparable to use ImmutableSortedSet#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 in ImmutableSortedSet, not this dummy version.

Parameters
<E>

Doc from java.util.Set.of. the Set's element type

e1:E

Doc from java.util.Set.of.

the first element

e2:E

Doc from java.util.Set.of.

the second element

e3:E

Doc from java.util.Set.of.

the third element

Returns:ImmutableSortedSet<E>

Doc from java.util.Set.of.

a Set containing the specified elements

Annotations
@DoNotCall:Pass parameters of type Comparable
@Deprecated
Exceptions
UnsupportedOperationException:
always
ofback to summary
public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4)

Hides com.google.common.collect.ImmutableSet.of, java.util.Set.of.

Deprecated

Pass the parameters of type Comparable to use ImmutableSortedSet#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 in ImmutableSortedSet, not this dummy version.

Parameters
<E>

Doc from java.util.Set.of. the Set's element type

e1:E

Doc from java.util.Set.of.

the first element

e2:E

Doc from java.util.Set.of.

the second element

e3:E

Doc from java.util.Set.of.

the third element

e4:E

Doc from java.util.Set.of.

the fourth element

Returns:ImmutableSortedSet<E>

Doc from java.util.Set.of.

a Set containing the specified elements

Annotations
@DoNotCall:Pass parameters of type Comparable
@Deprecated
Exceptions
UnsupportedOperationException:
always
ofback to summary
public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4, E e5)

Hides com.google.common.collect.ImmutableSet.of, java.util.Set.of.

Deprecated

Pass the parameters of type Comparable to use ImmutableSortedSet#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 in ImmutableSortedSet, not this dummy version.

Parameters
<E>

Doc from java.util.Set.of. the Set's element type

e1:E

Doc from java.util.Set.of.

the first element

e2:E

Doc from java.util.Set.of.

the second element

e3:E

Doc from java.util.Set.of.

the third element

e4:E

Doc from java.util.Set.of.

the fourth element

e5:E

Doc from java.util.Set.of.

the fifth element

Returns:ImmutableSortedSet<E>

Doc from java.util.Set.of.

a Set containing the specified elements

Annotations
@DoNotCall:Pass parameters of type Comparable
@Deprecated
Exceptions
UnsupportedOperationException:
always
ofback to summary
public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E... remaining)

Hides com.google.common.collect.ImmutableSet.of, java.util.Set.of.

Not supported. You are attempting to create a set that may contain a non-Comparable element. Proper calls will resolve to the version in ImmutableSortedSet, not this dummy version.

Parameters
<E>

Doc from java.util.Set.of. the Set's element type

e1:E

Doc from java.util.Set.of.

the first element

e2:E

Doc from java.util.Set.of.

the second element

e3:E

Doc from java.util.Set.of.

the third element

e4:E

Doc from java.util.Set.of.

the fourth element

e5:E

Doc from java.util.Set.of.

the fifth element

e6:E

Doc from java.util.Set.of.

the sixth element

remaining:E[]

Doc from java.util.Set.of.

the seventh element

Returns:ImmutableSortedSet<E>

Doc from java.util.Set.of.

a Set containing the specified elements

Annotations
@DoNotCall:Pass parameters of type Comparable
@Deprecated
Exceptions
UnsupportedOperationException:
always
toImmutableSetback to summary
public static <E> Collector<E, ?, ImmutableSet<E>> toImmutableSet()

Hides com.google.common.collect.ImmutableSet.toImmutableSet.

Not supported. Use ImmutableSortedSet#toImmutableSortedSet instead. This method exists only to hide ImmutableSet#toImmutableSet from consumers of ImmutableSortedSet.

Annotations
@DoNotCall:Use toImmutableSortedSet
@Deprecated
Exceptions
UnsupportedOperationException:
always
Since
21.0