Class CompactSet.Builder<E>

java.lang.Object
com.cedarsoftware.util.CompactSet.Builder<E>
Enclosing class:
CompactSet<E>

public static final class CompactSet.Builder<E> extends Object
Builder for creating CompactSet instances with custom configurations.

Internally, the builder configures a CompactMap (with <E, Object>).

  • Method Details

    • caseSensitive

      public CompactSet.Builder<E> caseSensitive(boolean caseSensitive)
      Sets whether String elements should be compared case-sensitively.
      Parameters:
      caseSensitive - if false, do case-insensitive compares
    • compactSize

      public CompactSet.Builder<E> compactSize(int size)
      Sets the maximum size for compact array storage.
    • sortedOrder

      public CompactSet.Builder<E> sortedOrder()
      Configures the set to maintain elements in natural sorted order.

      Requires elements to be Comparable

    • reverseOrder

      public CompactSet.Builder<E> reverseOrder()
      Configures the set to maintain elements in reverse sorted order.

      Requires elements to be Comparable

    • insertionOrder

      public CompactSet.Builder<E> insertionOrder()
      Configures the set to maintain elements in insertion order.
    • noOrder

      public CompactSet.Builder<E> noOrder()
      Configures the set to maintain elements in no specific order, like a HashSet.
    • build

      public CompactSet<E> build()
      Creates a new CompactSet with the configured options.