Package com.google.common.collect
Class ImmutableSortedMultisetFauxverideShim<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- com.google.common.collect.ImmutableCollection<E>
-
- com.google.common.collect.ImmutableMultiset<E>
-
- com.google.common.collect.ImmutableSortedMultisetFauxverideShim<E>
-
- All Implemented Interfaces:
Multiset<E>
,java.io.Serializable
,java.lang.Iterable<E>
,java.util.Collection<E>
- Direct Known Subclasses:
ImmutableSortedMultiset
@GwtIncompatible abstract class ImmutableSortedMultisetFauxverideShim<E> extends ImmutableMultiset<E>
"Overrides" theImmutableMultiset
static methods that lackImmutableSortedMultiset
equivalents with deprecated, exception-throwing versions. This prevents accidents like the following:List<Object> objects = ...; // Sort them: Set<Object> sorted = ImmutableSortedMultiset.copyOf(objects); // BAD CODE! The returned multiset is actually an unsorted ImmutableMultiset!
While we could put the overrides in
ImmutableSortedMultiset
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.ImmutableMultiset
ImmutableMultiset.Builder<E>, ImmutableMultiset.EntrySetSerializedForm<E>
-
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableCollection
ImmutableCollection.ArrayBasedBuilder<E>
-
Nested classes/interfaces inherited from interface com.google.common.collect.Multiset
Multiset.Entry<E>
-
-
Constructor Summary
Constructors Constructor Description ImmutableSortedMultisetFauxverideShim()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <E> ImmutableSortedMultiset.Builder<E>
builder()
Deprecated.UseImmutableSortedMultiset.naturalOrder()
, which offers better type-safety.static <E> ImmutableSortedMultiset<E>
copyOf(E[] elements)
Deprecated.Pass parameters of typeComparable
to useImmutableSortedMultiset.copyOf(Comparable[])
.static <E> ImmutableSortedMultiset<E>
of(E element)
Deprecated.Pass a parameter of typeComparable
to useImmutableSortedMultiset.of(Comparable)
.static <E> ImmutableSortedMultiset<E>
of(E e1, E e2)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedMultiset.of(Comparable, Comparable)
.static <E> ImmutableSortedMultiset<E>
of(E e1, E e2, E e3)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedMultiset.of(Comparable, Comparable, Comparable)
.static <E> ImmutableSortedMultiset<E>
of(E e1, E e2, E e3, E e4)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedMultiset.of(Comparable, Comparable, Comparable, Comparable)
.static <E> ImmutableSortedMultiset<E>
of(E e1, E e2, E e3, E e4, E e5)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedMultiset.of(Comparable, Comparable, Comparable, Comparable, Comparable)
.static <E> ImmutableSortedMultiset<E>
of(E e1, E e2, E e3, E e4, E e5, E e6, E... remaining)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedMultiset.of(Comparable, Comparable, Comparable, Comparable, Comparable, Comparable, Comparable...)
.-
Methods inherited from class com.google.common.collect.ImmutableMultiset
add, asList, contains, copyFromEntries, copyIntoArray, copyOf, copyOf, createAsList, entrySet, equals, getEntry, hashCode, iterator, of, remove, setCount, setCount, toString, writeReplace
-
Methods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, isPartialView, remove, removeAll, retainAll, toArray, toArray
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
addAll, clear, isEmpty, parallelStream, removeIf, size, spliterator, stream, toArray, toArray, toArray
-
Methods inherited from interface com.google.common.collect.Multiset
add, containsAll, count, elementSet, remove, removeAll, retainAll
-
-
-
-
Method Detail
-
builder
@Deprecated public static <E> ImmutableSortedMultiset.Builder<E> builder()
Deprecated.UseImmutableSortedMultiset.naturalOrder()
, which offers better type-safety.Not supported. UseImmutableSortedMultiset.naturalOrder()
, which offers better type-safety, instead. This method exists only to hideImmutableMultiset.builder()
from consumers ofImmutableSortedMultiset
.- Throws:
java.lang.UnsupportedOperationException
- always
-
of
@Deprecated public static <E> ImmutableSortedMultiset<E> of(E element)
Deprecated.Pass a parameter of typeComparable
to useImmutableSortedMultiset.of(Comparable)
.Not supported. You are attempting to create a multiset that may contain a non-Comparable
element. Proper calls will resolve to the version inImmutableSortedMultiset
, not this dummy version.- Throws:
java.lang.UnsupportedOperationException
- always
-
of
@Deprecated public static <E> ImmutableSortedMultiset<E> of(E e1, E e2)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedMultiset.of(Comparable, Comparable)
.Not supported. You are attempting to create a multiset that may contain a non-Comparable
element. Proper calls will resolve to the version inImmutableSortedMultiset
, not this dummy version.- Throws:
java.lang.UnsupportedOperationException
- always
-
of
@Deprecated public static <E> ImmutableSortedMultiset<E> of(E e1, E e2, E e3)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedMultiset.of(Comparable, Comparable, Comparable)
.Not supported. You are attempting to create a multiset that may contain a non-Comparable
element. Proper calls will resolve to the version inImmutableSortedMultiset
, not this dummy version.- Throws:
java.lang.UnsupportedOperationException
- always
-
of
@Deprecated public static <E> ImmutableSortedMultiset<E> of(E e1, E e2, E e3, E e4)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedMultiset.of(Comparable, Comparable, Comparable, Comparable)
.Not supported. You are attempting to create a multiset that may contain a non-Comparable
element. Proper calls will resolve to the version inImmutableSortedMultiset
, not this dummy version.- Throws:
java.lang.UnsupportedOperationException
- always
-
of
@Deprecated public static <E> ImmutableSortedMultiset<E> of(E e1, E e2, E e3, E e4, E e5)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedMultiset.of(Comparable, Comparable, Comparable, Comparable, Comparable)
.Not supported. You are attempting to create a multiset that may contain a non-Comparable
element. Proper calls will resolve to the version inImmutableSortedMultiset
, not this dummy version.- Throws:
java.lang.UnsupportedOperationException
- always
-
of
@Deprecated public static <E> ImmutableSortedMultiset<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E... remaining)
Deprecated.Pass the parameters of typeComparable
to useImmutableSortedMultiset.of(Comparable, Comparable, Comparable, Comparable, Comparable, Comparable, Comparable...)
.Not supported. You are attempting to create a multiset that may contain a non-Comparable
element. Proper calls will resolve to the version inImmutableSortedMultiset
, not this dummy version.- Throws:
java.lang.UnsupportedOperationException
- always
-
copyOf
@Deprecated public static <E> ImmutableSortedMultiset<E> copyOf(E[] elements)
Deprecated.Pass parameters of typeComparable
to useImmutableSortedMultiset.copyOf(Comparable[])
.Not supported. You are attempting to create a multiset that may contain non-Comparable
elements. Proper calls will resolve to the version inImmutableSortedMultiset
, not this dummy version.- Throws:
java.lang.UnsupportedOperationException
- always
-
-