Class ImmutableIntArray.Builder

java.lang.Object
dev.mccue.guava.primitives.ImmutableIntArray.Builder
Enclosing class:
ImmutableIntArray

public static final class ImmutableIntArray.Builder extends Object
A builder for ImmutableIntArray instances; obtained using ImmutableIntArray#builder.
  • Method Details

    • add

      @CanIgnoreReturnValue public ImmutableIntArray.Builder add(int value)
      Appends value to the end of the values the built ImmutableIntArray will contain.
    • addAll

      @CanIgnoreReturnValue public ImmutableIntArray.Builder addAll(int[] values)
      Appends values, in order, to the end of the values the built ImmutableIntArray will contain.
    • addAll

      @CanIgnoreReturnValue public ImmutableIntArray.Builder addAll(Iterable<Integer> values)
      Appends values, in order, to the end of the values the built ImmutableIntArray will contain.
    • addAll

      @CanIgnoreReturnValue public ImmutableIntArray.Builder addAll(Collection<Integer> values)
      Appends values, in order, to the end of the values the built ImmutableIntArray will contain.
    • addAll

      @CanIgnoreReturnValue public ImmutableIntArray.Builder addAll(IntStream stream)
      Appends all values from stream, in order, to the end of the values the built ImmutableIntArray will contain.
    • addAll

      @CanIgnoreReturnValue public ImmutableIntArray.Builder addAll(ImmutableIntArray values)
      Appends values, in order, to the end of the values the built ImmutableIntArray will contain.
    • build

      public ImmutableIntArray build()
      Returns a new immutable array. The builder can continue to be used after this call, to append more values and build again.

      Performance note: the returned array is backed by the same array as the builder, so no data is copied as part of this step, but this may occupy more memory than strictly necessary. To copy the data to a right-sized backing array, use .build().trimmed().