Class ImmutableDoubleArray.Builder

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

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

    • add

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

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

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

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

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

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

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