Package com.google.common.primitives
Class ImmutableDoubleArray.Builder
- java.lang.Object
-
- com.google.common.primitives.ImmutableDoubleArray.Builder
-
- Enclosing class:
- ImmutableDoubleArray
public static final class ImmutableDoubleArray.Builder extends java.lang.ObjectA builder forImmutableDoubleArrayinstances; obtained usingImmutableDoubleArray.builder(int).
-
-
Constructor Summary
Constructors Constructor Description Builder(int initialCapacity)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableDoubleArray.Builderadd(double value)Appendsvalueto the end of the values the builtImmutableDoubleArraywill contain.ImmutableDoubleArray.BuilderaddAll(double[] values)Appendsvalues, in order, to the end of the values the builtImmutableDoubleArraywill contain.ImmutableDoubleArray.BuilderaddAll(ImmutableDoubleArray values)Appendsvalues, in order, to the end of the values the builtImmutableDoubleArraywill contain.ImmutableDoubleArray.BuilderaddAll(java.lang.Iterable<java.lang.Double> values)Appendsvalues, in order, to the end of the values the builtImmutableDoubleArraywill contain.ImmutableDoubleArray.BuilderaddAll(java.util.Collection<java.lang.Double> values)Appendsvalues, in order, to the end of the values the builtImmutableDoubleArraywill contain.ImmutableDoubleArray.BuilderaddAll(java.util.stream.DoubleStream stream)Appends all values fromstream, in order, to the end of the values the builtImmutableDoubleArraywill contain.ImmutableDoubleArraybuild()Returns a new immutable array.private voidensureRoomFor(int numberToAdd)private static intexpandedCapacity(int oldCapacity, int minCapacity)
-
-
-
Method Detail
-
add
public ImmutableDoubleArray.Builder add(double value)
Appendsvalueto the end of the values the builtImmutableDoubleArraywill contain.
-
addAll
public ImmutableDoubleArray.Builder addAll(double[] values)
Appendsvalues, in order, to the end of the values the builtImmutableDoubleArraywill contain.
-
addAll
public ImmutableDoubleArray.Builder addAll(java.lang.Iterable<java.lang.Double> values)
Appendsvalues, in order, to the end of the values the builtImmutableDoubleArraywill contain.
-
addAll
public ImmutableDoubleArray.Builder addAll(java.util.Collection<java.lang.Double> values)
Appendsvalues, in order, to the end of the values the builtImmutableDoubleArraywill contain.
-
addAll
public ImmutableDoubleArray.Builder addAll(java.util.stream.DoubleStream stream)
Appends all values fromstream, in order, to the end of the values the builtImmutableDoubleArraywill contain.
-
addAll
public ImmutableDoubleArray.Builder addAll(ImmutableDoubleArray values)
Appendsvalues, in order, to the end of the values the builtImmutableDoubleArraywill contain.
-
ensureRoomFor
private void ensureRoomFor(int numberToAdd)
-
expandedCapacity
private static int expandedCapacity(int oldCapacity, int minCapacity)
-
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().
-
-