public static final class ImmutableLongArray.Builder
extends java.lang.Object
ImmutableLongArray
instances; obtained using ImmutableLongArray.builder(int)
.Constructor and Description |
---|
Builder(int initialCapacity) |
Modifier and Type | Method and Description |
---|---|
ImmutableLongArray.Builder |
add(long value)
Appends
value to the end of the values the built ImmutableLongArray will
contain. |
ImmutableLongArray.Builder |
addAll(java.util.Collection<java.lang.Long> values)
Appends
values , in order, to the end of the values the built ImmutableLongArray will contain. |
ImmutableLongArray.Builder |
addAll(ImmutableLongArray values)
Appends
values , in order, to the end of the values the built ImmutableLongArray will contain. |
ImmutableLongArray.Builder |
addAll(java.lang.Iterable<java.lang.Long> values)
Appends
values , in order, to the end of the values the built ImmutableLongArray will contain. |
ImmutableLongArray.Builder |
addAll(long[] values)
Appends
values , in order, to the end of the values the built ImmutableLongArray will contain. |
ImmutableLongArray.Builder |
addAll(java.util.stream.LongStream stream)
Appends all values from
stream , in order, to the end of the values the built ImmutableLongArray will contain. |
ImmutableLongArray |
build()
Returns a new immutable array.
|
private void |
ensureRoomFor(int numberToAdd) |
private static int |
expandedCapacity(int oldCapacity,
int minCapacity) |
public ImmutableLongArray.Builder add(long value)
value
to the end of the values the built ImmutableLongArray
will
contain.public ImmutableLongArray.Builder addAll(long[] values)
values
, in order, to the end of the values the built ImmutableLongArray
will contain.public ImmutableLongArray.Builder addAll(java.lang.Iterable<java.lang.Long> values)
values
, in order, to the end of the values the built ImmutableLongArray
will contain.public ImmutableLongArray.Builder addAll(java.util.Collection<java.lang.Long> values)
values
, in order, to the end of the values the built ImmutableLongArray
will contain.public ImmutableLongArray.Builder addAll(java.util.stream.LongStream stream)
stream
, in order, to the end of the values the built ImmutableLongArray
will contain.public ImmutableLongArray.Builder addAll(ImmutableLongArray values)
values
, in order, to the end of the values the built ImmutableLongArray
will contain.private void ensureRoomFor(int numberToAdd)
private static int expandedCapacity(int oldCapacity, int minCapacity)
public ImmutableLongArray build()
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()
.