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