Package com.google.common.primitives
Class ImmutableDoubleArray.Builder
- java.lang.Object
-
- com.google.common.primitives.ImmutableDoubleArray.Builder
-
- Enclosing class:
- ImmutableDoubleArray
@CanIgnoreReturnValue public static final class ImmutableDoubleArray.Builder extends Object
A builder forImmutableDoubleArray
instances; obtained usingImmutableDoubleArray.builder(int)
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableDoubleArray.Builder
add(double value)
Appendsvalue
to the end of the values the builtImmutableDoubleArray
will contain.ImmutableDoubleArray.Builder
addAll(double[] values)
Appendsvalues
, in order, to the end of the values the builtImmutableDoubleArray
will contain.ImmutableDoubleArray.Builder
addAll(ImmutableDoubleArray values)
Appendsvalues
, in order, to the end of the values the builtImmutableDoubleArray
will contain.ImmutableDoubleArray.Builder
addAll(Iterable<Double> values)
Appendsvalues
, in order, to the end of the values the builtImmutableDoubleArray
will contain.ImmutableDoubleArray.Builder
addAll(Collection<Double> values)
Appendsvalues
, in order, to the end of the values the builtImmutableDoubleArray
will contain.ImmutableDoubleArray.Builder
addAll(DoubleStream stream)
Appends all values fromstream
, in order, to the end of the values the builtImmutableDoubleArray
will contain.ImmutableDoubleArray
build()
Returns a new immutable array.
-
-
-
Method Detail
-
add
public ImmutableDoubleArray.Builder add(double value)
Appendsvalue
to the end of the values the builtImmutableDoubleArray
will contain.
-
addAll
public ImmutableDoubleArray.Builder addAll(double[] values)
Appendsvalues
, in order, to the end of the values the builtImmutableDoubleArray
will contain.
-
addAll
public ImmutableDoubleArray.Builder addAll(Iterable<Double> values)
Appendsvalues
, in order, to the end of the values the builtImmutableDoubleArray
will contain.
-
addAll
public ImmutableDoubleArray.Builder addAll(Collection<Double> values)
Appendsvalues
, in order, to the end of the values the builtImmutableDoubleArray
will contain.
-
addAll
public ImmutableDoubleArray.Builder addAll(DoubleStream stream)
Appends all values fromstream
, in order, to the end of the values the builtImmutableDoubleArray
will contain.
-
addAll
public ImmutableDoubleArray.Builder addAll(ImmutableDoubleArray values)
Appendsvalues
, in order, to the end of the values the builtImmutableDoubleArray
will contain.
-
build
@CheckReturnValue 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()
.
-
-