Top Description Fields Constructors Methods
org.python.core.stringlib

public final Class IntArrayBuilder

extends Forward
Class Inheritance
Imports
java.util.Arrays, .Spliterator, java.util.stream.IntStream

An elastic buffer of integer values, somewhat like the java.lang.StringBuilder, but for arrays of integers. The client appends data and may finally take the built array, often without copying the data.

Field Summary

Modifier and TypeField and Description
private int
private int
private int[]

Constructor Summary

AccessConstructor and Description
public
IntArrayBuilder(int
initially
capacity
)

Create an empty buffer of a defined initial capacity.

public
IntArrayBuilder()

Create an empty buffer of a default initial capacity.

Method Summary

Modifier and TypeMethod and Description
public IntArrayBuilder

Returns:

this builder
append
(IntStream
stream to append from
s
)

Append the ints from the given stream.

protected void
appendUnchecked(int
to append
v
)

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.Forward.appendUnchecked.

Append one element without ensuring that there is space.
protected void
ensure(int
to make space for
n
)

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.ensure.

Ensure there is room for another n elements.
public int
length()

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.length.

The number of elements currently
public int
max()

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.max.

The maximum value stored.
public int[]
take()

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.take.

Provide the contents as an array and reset the builder to empty.
protected int[]
value()

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.value.

An array of the elements in the buffer (not modified by methods on this object hereafter).
Inherited from org.python.core.stringlib.AbstractIntArrayBuilder.Forward:
appendappendappend

Field Detail

lenback to summary
private int len
maxback to summary
private int max
valueback to summary
private int[] value

Constructor Detail

IntArrayBuilderback to summary
public IntArrayBuilder(int capacity)

Create an empty buffer of a defined initial capacity.

Parameters
capacity:int

initially

IntArrayBuilderback to summary
public IntArrayBuilder()

Create an empty buffer of a default initial capacity.

Method Detail

appendback to summary
public IntArrayBuilder append(IntStream s)

Append the ints from the given stream.

Parameters
s:IntStream

stream to append from

Returns:IntArrayBuilder

this builder

appendUncheckedback to summary
protected void appendUnchecked(int v)

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.Forward.appendUnchecked.

Doc from org.python.core.stringlib.AbstractIntArrayBuilder.Forward.appendUnchecked.

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(int) has been called.

Parameters
v:int

to append

Annotations
@Override
ensureback to summary
protected void ensure(int n)

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.ensure.

Ensure there is room for another n elements.

Parameters
n:int

to make space for

Annotations
@Override
lengthback to summary
public int length()

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.length.

Doc from org.python.core.stringlib.AbstractIntArrayBuilder.length.

The number of elements currently

Returns:int

the number of elements currently.

Annotations
@Override
maxback to summary
public int max()

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.max.

Doc from org.python.core.stringlib.AbstractIntArrayBuilder.max.

The maximum value stored.

Returns:int

The maximum int stored.

Annotations
@Override
takeback to summary
public int[] take()

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.take.

Doc from org.python.core.stringlib.AbstractIntArrayBuilder.take.

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, int[] or byte[]).

Returns:int[]

the contents as a Python str

Annotations
@Override
valueback to summary
protected int[] value()

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.value.

Doc from org.python.core.stringlib.AbstractIntArrayBuilder.value.

An array of the elements in the buffer (not modified by methods on this object hereafter).

Returns:int[]

the elements in the buffer

Annotations
@Override