java.lang.StringBuilder
, but for arrays of integers. The
client appends data and may finally take the built array, often
without copying the data.
Modifier and Type | Field and Description |
---|---|
private int | |
private int | |
private int[] |
Access | Constructor and Description |
---|---|
public | |
public |
Modifier and Type | Method and Description |
---|---|
public IntArrayBuilder | |
protected void | appendUnchecked(int
to append v)Implements abstract org. |
protected void | ensure(int
to make space for n)Implements abstract org. n elements.
|
public int | length()
Implements abstract org. |
public int | max()
Implements abstract org. |
public int[] | take()
Implements abstract org. |
protected int[] | value()
Implements abstract org. |
len | back to summary |
---|---|
private int len |
max | back to summary |
---|---|
private int max |
value | back to summary |
---|---|
private int[] value |
IntArrayBuilder | back to summary |
---|---|
public IntArrayBuilder(int capacity) Create an empty buffer of a defined initial capacity.
|
IntArrayBuilder | back to summary |
---|---|
public IntArrayBuilder() Create an empty buffer of a default initial capacity. |
append | back to summary |
---|---|
public IntArrayBuilder append(IntStream s) Append the
|
appendUnchecked | back to summary |
---|---|
protected void appendUnchecked(int v) Implements abstract org. Doc from org. Append one element without ensuring that there is space. This
method is for use when it is known that there is space for the
element, for example, inside a loop before which when
|
ensure | back to summary |
---|---|
protected void ensure(int n) Implements abstract org. Ensure there is room for another
|
length | back to summary |
---|---|
public int length() Implements abstract org. Doc from org. The number of elements currently
|
max | back to summary |
---|---|
public int max() Implements abstract org. Doc from org. The maximum value stored.
|
take | back to summary |
---|---|
public int[] take() Implements abstract org. Doc from org. Provide the contents as an array and reset the builder to empty.
(This is a "destructive read".) The return type is Object in
order that sub-classes may define the specific type (for example,
|
value | back to summary |
---|---|
protected int[] value() Implements abstract org. Doc from org. An array of the elements in the buffer (not modified by methods on this object hereafter).
|