Class ImmutableLongArray.Builder

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

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

    • add

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

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

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

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

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

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

      public ImmutableLongArray 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().