Class ImmutableSortedSet.Builder<E>

  • Enclosing class:
    ImmutableSortedSet<E>

    public static final class ImmutableSortedSet.Builder<E>
    extends ImmutableSet.Builder<E>
    A builder for creating immutable sorted set instances, especially public static final sets ("constant sets"), with a given comparator. Example:
    
     public static final ImmutableSortedSet<Number> LUCKY_NUMBERS =
         new ImmutableSortedSet.Builder<Number>(ODDS_FIRST_COMPARATOR)
             .addAll(SINGLE_DIGIT_PRIMES)
             .add(42)
             .build();
     

    Builder instances can be reused; it is safe to call build() multiple times to build multiple sets in series. Each set is a superset of the set created before it.

    Since:
    2.0