Package com.google.common.primitives
Class ImmutableLongArray.Builder
- java.lang.Object
-
- com.google.common.primitives.ImmutableLongArray.Builder
-
- Enclosing class:
- ImmutableLongArray
@CanIgnoreReturnValue public static final class ImmutableLongArray.Builder extends Object
A builder forImmutableLongArrayinstances; obtained usingImmutableLongArray.builder(int).
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableLongArray.Builderadd(long value)Appendsvalueto the end of the values the builtImmutableLongArraywill contain.ImmutableLongArray.BuilderaddAll(long[] values)Appendsvalues, in order, to the end of the values the builtImmutableLongArraywill contain.ImmutableLongArray.BuilderaddAll(ImmutableLongArray values)Appendsvalues, in order, to the end of the values the builtImmutableLongArraywill contain.ImmutableLongArray.BuilderaddAll(Iterable<Long> values)Appendsvalues, in order, to the end of the values the builtImmutableLongArraywill contain.ImmutableLongArray.BuilderaddAll(Collection<Long> values)Appendsvalues, in order, to the end of the values the builtImmutableLongArraywill contain.ImmutableLongArray.BuilderaddAll(LongStream stream)Appends all values fromstream, in order, to the end of the values the builtImmutableLongArraywill contain.ImmutableLongArraybuild()Returns a new immutable array.
-
-
-
Method Detail
-
add
public ImmutableLongArray.Builder add(long value)
Appendsvalueto the end of the values the builtImmutableLongArraywill contain.
-
addAll
public ImmutableLongArray.Builder addAll(long[] values)
Appendsvalues, in order, to the end of the values the builtImmutableLongArraywill contain.
-
addAll
public ImmutableLongArray.Builder addAll(Iterable<Long> values)
Appendsvalues, in order, to the end of the values the builtImmutableLongArraywill contain.
-
addAll
public ImmutableLongArray.Builder addAll(Collection<Long> values)
Appendsvalues, in order, to the end of the values the builtImmutableLongArraywill contain.
-
addAll
public ImmutableLongArray.Builder addAll(LongStream stream)
Appends all values fromstream, in order, to the end of the values the builtImmutableLongArraywill contain.
-
addAll
public ImmutableLongArray.Builder addAll(ImmutableLongArray values)
Appendsvalues, in order, to the end of the values the builtImmutableLongArraywill contain.
-
build
@CheckReturnValue 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().
-
-