APIdia Launch Partner
Top Description Fields Constructors Methods
java.util.stream

pack-priv abstract Class AbstractSpinedBuffer

extends Object
Class Inheritance
Known Direct Subclasses
java.util.stream.SpinedBuffer, java.util.stream.SpinedBuffer.OfPrimitive

Base class for a data structure for gathering elements into a buffer and then iterating them. Maintains an array of increasingly sized arrays, so there is no copying cost associated with growing the data structure.
Since
1.8

Field Summary

Modifier and TypeField and Description
protected int
elementIndex

Index of the *next* element to write; may point into, or just outside of, the current chunk.

protected final int
initialChunkPower

log2 of the size of the first chunk.

public static final int
MAX_CHUNK_POWER

Max power-of-two for chunks.

public static final int
MIN_CHUNK_POWER

Minimum power-of-two for the first chunk.

public static final int
MIN_CHUNK_SIZE

Minimum size for the first chunk.

public static final int
MIN_SPINE_SIZE

Minimum array size for array-of-chunks.

protected long[]
priorElementCount

Count of elements in all prior chunks.

protected int
spineIndex

Index of the *current* chunk in the spine array, if the spine array is non-null.

Constructor Summary

AccessConstructor and Description
protected
AbstractSpinedBuffer()

Construct with an initial capacity of 16.

protected
AbstractSpinedBuffer(int
The minimum expected number of elements
initialCapacity
)

Construct with a specified initial capacity.

Method Summary

Modifier and TypeMethod and Description
protected int
chunkSize(int n)

How big should the nth chunk be?

public abstract void
clear()

Remove all data from the buffer

public long
count()

How many elements are currently in the buffer?

public boolean
isEmpty()

Is the buffer currently empty?

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

elementIndexback to summary
protected int elementIndex

Index of the *next* element to write; may point into, or just outside of, the current chunk.

initialChunkPowerback to summary
protected final int initialChunkPower

log2 of the size of the first chunk.

MAX_CHUNK_POWERback to summary
public static final int MAX_CHUNK_POWER

Max power-of-two for chunks.

MIN_CHUNK_POWERback to summary
public static final int MIN_CHUNK_POWER

Minimum power-of-two for the first chunk.

MIN_CHUNK_SIZEback to summary
public static final int MIN_CHUNK_SIZE

Minimum size for the first chunk.

MIN_SPINE_SIZEback to summary
public static final int MIN_SPINE_SIZE

Minimum array size for array-of-chunks.

priorElementCountback to summary
protected long[] priorElementCount

Count of elements in all prior chunks.

spineIndexback to summary
protected int spineIndex

Index of the *current* chunk in the spine array, if the spine array is non-null.

Constructor Detail

AbstractSpinedBufferback to summary
protected AbstractSpinedBuffer()

Construct with an initial capacity of 16.

AbstractSpinedBufferback to summary
protected AbstractSpinedBuffer(int initialCapacity)

Construct with a specified initial capacity.

Parameters
initialCapacity:int

The minimum expected number of elements

Method Detail

chunkSizeback to summary
protected int chunkSize(int n)

How big should the nth chunk be?

clearback to summary
public abstract void clear()

Remove all data from the buffer

countback to summary
public long count()

How many elements are currently in the buffer?

isEmptyback to summary
public boolean isEmpty()

Is the buffer currently empty?