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>,java.io.Serializable,java.lang.Iterable<E>,java.util.Collection<E>
- Direct Known Subclasses:
ImmutableSortedMultiset
abstract class ImmutableSortedMultisetFauxverideShim<E> extends ImmutableMultiset<E>
"Overrides" theImmutableMultisetstatic methods that lackImmutableSortedMultisetequivalents 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
ImmutableSortedMultisetitself, 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 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 typeComparableto useImmutableSortedMultiset.copyOf(Comparable[]).static <E> ImmutableSortedMultiset<E>of(E element)Deprecated.Pass a parameter of typeComparableto useImmutableSortedMultiset.of(Comparable).static <E> ImmutableSortedMultiset<E>of(E e1, E e2)Deprecated.Pass the parameters of typeComparableto useImmutableSortedMultiset.of(Comparable, Comparable).static <E> ImmutableSortedMultiset<E>of(E e1, E e2, E e3)Deprecated.Pass the parameters of typeComparableto useImmutableSortedMultiset.of(Comparable, Comparable, Comparable).static <E> ImmutableSortedMultiset<E>of(E e1, E e2, E e3, E e4)Deprecated.Pass the parameters of typeComparableto 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 typeComparableto 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 typeComparableto useImmutableSortedMultiset.of(Comparable, Comparable, Comparable, Comparable, Comparable, Comparable, Comparable...).static <E> java.util.stream.Collector<E,?,ImmutableMultiset<E>>toImmutableMultiset()static <T,E>
java.util.stream.Collector<T,?,ImmutableMultiset<E>>toImmutableMultiset(java.util.function.Function<? super T,? extends E> elementFunction, java.util.function.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.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
-
-
-
-
Method Detail
-
toImmutableMultiset
@Deprecated public static <E> java.util.stream.Collector<E,?,ImmutableMultiset<E>> toImmutableMultiset()
Not supported. UseImmutableSortedMultiset.toImmutableSortedMultiset(java.util.Comparator<? super E>)instead. This method exists only to hideImmutableMultiset.toImmutableMultiset()from consumers ofImmutableSortedMultiset.- Throws:
java.lang.UnsupportedOperationException- always- Since:
- 21.0
-
toImmutableMultiset
@Deprecated public static <T,E> java.util.stream.Collector<T,?,ImmutableMultiset<E>> toImmutableMultiset(java.util.function.Function<? super T,? extends E> elementFunction, java.util.function.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:
java.lang.UnsupportedOperationException- always- Since:
- 22.0
-
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 typeComparableto useImmutableSortedMultiset.of(Comparable).Not supported. You are attempting to create a multiset that may contain a non-Comparableelement. 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 typeComparableto useImmutableSortedMultiset.of(Comparable, Comparable).Not supported. You are attempting to create a multiset that may contain a non-Comparableelement. 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 typeComparableto useImmutableSortedMultiset.of(Comparable, Comparable, Comparable).Not supported. You are attempting to create a multiset that may contain a non-Comparableelement. 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 typeComparableto useImmutableSortedMultiset.of(Comparable, Comparable, Comparable, Comparable).Not supported. You are attempting to create a multiset that may contain a non-Comparableelement. 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 typeComparableto useImmutableSortedMultiset.of(Comparable, Comparable, Comparable, Comparable, Comparable).Not supported. You are attempting to create a multiset that may contain a non-Comparableelement. 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 typeComparableto useImmutableSortedMultiset.of(Comparable, Comparable, Comparable, Comparable, Comparable, Comparable, Comparable...).Not supported. You are attempting to create a multiset that may contain a non-Comparableelement. 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 typeComparableto useImmutableSortedMultiset.copyOf(Comparable[]).Not supported. You are attempting to create a multiset that may contain non-Comparableelements. Proper calls will resolve to the version inImmutableSortedMultiset, not this dummy version.- Throws:
java.lang.UnsupportedOperationException- always
-
-