Class ImmutableSortedMultiset.Builder<E>

  • Enclosing class:
    ImmutableSortedMultiset<E>

    public static class ImmutableSortedMultiset.Builder<E>
    extends ImmutableMultiset.Builder<E>
    A builder for creating immutable multiset instances, especially public static final multisets ("constant multisets"). Example:
    
     public static final ImmutableSortedMultiset<Bean> BEANS =
         new ImmutableSortedMultiset.Builder<Bean>(colorComparator())
             .addCopies(Bean.COCOA, 4)
             .addCopies(Bean.GARDEN, 6)
             .addCopies(Bean.RED, 8)
             .addCopies(Bean.BLACK_EYED, 10)
             .build();
     

    Builder instances can be reused; it is safe to call build() multiple times to build multiple multisets in series.

    Since:
    12.0