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