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

pack-priv Class SpinedBuffer<E>

extends AbstractSpinedBuffer
implements Consumer<E>, Iterable<E>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable, java.util.function.Consumer
Known Direct Subclasses
java.util.stream.GathererOp.NodeBuilder.Builder, java.util.stream.Nodes.SpinedNodeBuilder
Type Parameters
<E>
the type of elements in this list
Imports
java.util.ArrayList, .Arrays, .Iterator, .List, .Objects, .PrimitiveIterator, .Spliterator, .Spliterators, java.util.function.Consumer, .DoubleConsumer, .IntConsumer, .IntFunction, .LongConsumer

An ordered collection of elements. Elements can be added, but not removed. Goes through a building phase, during which elements can be added, and a traversal phase, during which elements can be traversed in order but no further modifications are possible.

One or more arrays are used to store elements. The use of a multiple arrays has better performance characteristics than a single array used by ArrayList, as when the capacity of the list needs to be increased no copying of elements is required. This is usually beneficial in the case where the results will be traversed a small number of times.

Since
1.8

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
SpinedBuffer.OfDouble

An ordered collection of double values.

pack-priv static class
SpinedBuffer.OfInt

An ordered collection of int values.

pack-priv static class
SpinedBuffer.OfLong

An ordered collection of long values.

pack-priv abstract static class
SpinedBuffer.OfPrimitive<
the wrapper type for this primitive type
E
,
the array type for this primitive type
T_ARR
,
the Consumer type for this primitive type
T_CONS
>

An ordered collection of primitive values.

Field Summary

Modifier and TypeField and Description
protected E[]
curChunk

Chunk that we're currently writing into; may or may not be aliased with the first element of the spine.

protected E[][]
spine

All chunks, or null if there is only one chunk.

private static final int
Inherited from java.util.stream.AbstractSpinedBuffer:
elementIndexinitialChunkPowerMAX_CHUNK_POWERMIN_CHUNK_POWERMIN_CHUNK_SIZEMIN_SPINE_SIZEpriorElementCountspineIndex

Constructor Summary

AccessConstructor and Description
pack-priv
SpinedBuffer(int
the initial capacity of the list
initialCapacity
)

Constructs an empty list with the specified initial capacity.

pack-priv
SpinedBuffer()

Constructs an empty list with an initial capacity of sixteen.

Method Summary

Modifier and TypeMethod and Description
public void
accept(E e)

Implements java.util.function.Consumer.accept.

Performs this operation on the given argument.

public E[]
asArray(IntFunction<E[]> arrayFactory)

Create a new array using the specified array factory, and copy the elements into it.

protected long
capacity()

Returns the current capacity of the buffer

public void
clear()

Implements abstract java.util.stream.AbstractSpinedBuffer.clear.

Remove all data from the buffer

public void
copyInto(E[] array, int offset)

Copy the elements, starting at the specified offset, into the specified array.

protected final void
ensureCapacity(long targetSize)

Ensure that the buffer has at least capacity to hold the target size

public void
forEach(Consumer<? super E> consumer)

Overrides default java.lang.Iterable.forEach.

Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.

public E
get(long index)

Retrieve the element at the specified index.

protected void
increaseCapacity()

Force the buffer to increase its capacity.

private void
public Iterator<E>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

public Spliterator<E>
spliterator()

Overrides default java.lang.Iterable.spliterator.

Return a Spliterator describing the contents of the buffer.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.util.stream.AbstractSpinedBuffer:
chunkSizecountisEmpty