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.ImmutableMultisetGwtSerializationDependencies<E>
com.google.common.collect.ImmutableMultiset<E>
com.google.common.collect.ImmutableSortedMultisetFauxverideShim<E>
- All Implemented Interfaces:
Multiset<E>
,Serializable
,Iterable<E>
,Collection<E>
- Direct Known Subclasses:
ImmutableSortedMultiset
"Overrides" the
ImmutableMultiset
static methods that lack ImmutableSortedMultiset
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.ElementSet<E>, ImmutableMultiset.EntrySetSerializedForm<E>, ImmutableMultiset.SerializedForm
Nested classes/interfaces inherited from interface com.google.common.collect.Multiset
Multiset.Entry<E>
-
Field Summary
Fields inherited from class com.google.common.collect.ImmutableCollection
SPLITERATOR_CHARACTERISTICS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> ImmutableSortedMultiset.Builder
<E> builder()
Deprecated.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...)
.static <E> Collector
<E, ?, ImmutableMultiset<E>> static <T,
E> Collector <T, ?, ImmutableMultiset<E>> toImmutableMultiset
(Function<? super T, ? extends E> elementFunction, ToIntFunction<? super T> countFunction) Methods inherited from class com.google.common.collect.ImmutableMultiset
add, asList, contains, copyFromEntries, copyIntoArray, copyOf, copyOf, elementSet, entrySet, equals, getEntry, hashCode, iterator, of, remove, setCount, setCount, toString, writeReplace
Methods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, internalArray, internalArrayEnd, internalArrayStart, isPartialView, remove, removeAll, removeIf, retainAll, spliterator, toArray, toArray
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, size
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, stream, toArray, toArray, toArray
Methods inherited from interface com.google.common.collect.Multiset
add, containsAll, count, forEach, forEachEntry, remove, removeAll, retainAll, size, spliterator
-
Constructor Details
-
ImmutableSortedMultisetFauxverideShim
ImmutableSortedMultisetFauxverideShim()
-
-
Method Details
-
toImmutableMultiset
Not supported. UseImmutableSortedMultiset.toImmutableSortedMultiset(java.util.Comparator<? super E>)
instead. This method exists only to hideImmutableMultiset.toImmutableMultiset()
from consumers ofImmutableSortedMultiset
.- Throws:
UnsupportedOperationException
- always- Since:
- 21.0
-
toImmutableMultiset
@Deprecated public static <T,E> Collector<T,?, toImmutableMultisetImmutableMultiset<E>> (Function<? super T, ? extends E> elementFunction, ToIntFunction<? super T> countFunction) Not supported. UseImmutableSortedMultiset.toImmutableSortedMultiset(java.util.Comparator<? super E>)
instead. This method exists only to hideImmutableMultiset.toImmutableMultiset()
from consumers ofImmutableSortedMultiset
.- Throws:
UnsupportedOperationException
- always- Since:
- 22.0
-
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:
UnsupportedOperationException
- always
-
of
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:
UnsupportedOperationException
- always
-
of
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:
UnsupportedOperationException
- always
-
of
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:
UnsupportedOperationException
- always
-
of
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:
UnsupportedOperationException
- always
-
of
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:
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:
UnsupportedOperationException
- always
-
copyOf
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:
UnsupportedOperationException
- always
-
ImmutableSortedMultiset.naturalOrder()
, which offers better type-safety.