Class BitSet.Builder<T>

  • Type Parameters:
    T - Component type
    Enclosing interface:
    BitSet<T>

    public static class BitSet.Builder<T>
    extends java.lang.Object
    Builder of the BitSet. Encapsulates the conversion functions for T.
    • Constructor Summary

      Constructors 
      Constructor Description
      Builder​(Function1<java.lang.Integer,​T> fromInt, Function1<T,​java.lang.Integer> toInt)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.stream.Collector<T,​java.util.ArrayList<T>,​BitSet<T>> collector()
      Returns a Collector which may be used in conjunction with Stream.collect(java.util.stream.Collector) to obtain an ArrayList.
      BitSet<T> empty()
      Returns a new empty BitSet
      BitSet<T> fill​(int n, @NonNull java.util.function.Supplier<? extends T> s)
      Builds a new BitSet containing n copies of the same value
      BitSet<T> of​(T t)
      Builds a new BitSet from a specific value t
      BitSet<T> of​(T @NonNull ... values)
      Builds a new BitSet from a list of values
      BitSet<T> ofAll​(@NonNull java.lang.Iterable<? extends T> values)
      Builds a new BitSet from an Iterable
      BitSet<T> ofAll​(java.util.stream.Stream<? extends T> javaStream)
      Builds a new BitSet from a Stream of values
      BitSet<T> tabulate​(int n, @NonNull java.util.function.Function<? super java.lang.Integer,​? extends T> f)
      Builds a new BitSet tabulating a value n times
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Builder

        Builder​(Function1<java.lang.Integer,​T> fromInt,
                Function1<T,​java.lang.Integer> toInt)
    • Method Detail

      • collector

        public java.util.stream.Collector<T,​java.util.ArrayList<T>,​BitSet<T>> collector()
        Returns a Collector which may be used in conjunction with Stream.collect(java.util.stream.Collector) to obtain an ArrayList.
        Returns:
        A ArrayList Collector.
      • empty

        public BitSet<T> empty()
        Returns a new empty BitSet
        Returns:
        new empty BitSet
      • of

        public BitSet<T> of​(T t)
        Builds a new BitSet from a specific value t
        Parameters:
        t - value to build the BitSet from
        Returns:
        new BitSet
      • of

        @SafeVarargs
        public final BitSet<T> of​(T @NonNull ... values)
        Builds a new BitSet from a list of values
        Parameters:
        values - values to build the BitSet from
        Returns:
        new BitSet
      • ofAll

        public BitSet<T> ofAll​(@NonNull java.lang.Iterable<? extends T> values)
        Builds a new BitSet from an Iterable
        Parameters:
        values - iterable to build the BitSet from
        Returns:
        new BitSet
      • ofAll

        public BitSet<T> ofAll​(java.util.stream.Stream<? extends T> javaStream)
        Builds a new BitSet from a Stream of values
        Parameters:
        javaStream - stream of values to build the BitSet from
        Returns:
        new BitSet
      • tabulate

        public BitSet<T> tabulate​(int n,
                                  @NonNull java.util.function.Function<? super java.lang.Integer,​? extends T> f)
        Builds a new BitSet tabulating a value n times
        Parameters:
        n - number of times to tabulate
        f - function to tabulate
        Returns:
        new BitSet
      • fill

        public BitSet<T> fill​(int n,
                              @NonNull java.util.function.Supplier<? extends T> s)
        Builds a new BitSet containing n copies of the same value
        Parameters:
        n - number of times to copy the value
        s - value supplier
        Returns:
        new BitSet