public static interface Node.OfPrimitive<T,T_CONS,T_ARR,T_SPLITR extends Spliterator.OfPrimitive<T,T_CONS,T_SPLITR>,T_NODE extends Node.OfPrimitive<T,T_CONS,T_ARR,T_SPLITR,T_NODE>> extends Node<T>
Node.Builder<T>, Node.OfDouble, Node.OfInt, Node.OfLong, Node.OfPrimitive<T,T_CONS,T_ARR,T_SPLITR extends Spliterator.OfPrimitive<T,T_CONS,T_SPLITR>,T_NODE extends Node.OfPrimitive<T,T_CONS,T_ARR,T_SPLITR,T_NODE>>
Modifier and Type | Method and Description |
---|---|
default T[] |
asArray(IntFunction<T[]> generator)
Provides an array view of the contents of this node.
|
T_ARR |
asPrimitiveArray()
Views this node as a primitive array.
|
void |
copyInto(T_ARR array,
int offset)
Copies the content of this
Node into a primitive array,
starting at a given offset into the array. |
void |
forEach(T_CONS action)
Traverses the elements of this node, and invoke the provided
action with each element. |
default T_NODE |
getChild(int i)
Retrieves the child
Node at a given index. |
T_ARR |
newArray(int count)
Creates a new primitive array.
|
T_SPLITR |
spliterator()
Returns a
Spliterator describing the elements contained in this
Node . |
T_NODE |
truncate(long from,
long to,
IntFunction<T[]> generator)
Return a node describing a subsequence of the elements of this node,
starting at the given inclusive start offset and ending at the given
exclusive end offset.
|
T_SPLITR spliterator()
Spliterator
describing the elements contained in this
Node
.spliterator
in interface Node<T>
Spliterator.OfPrimitive
describing the elements of
this nodevoid forEach(T_CONS action)
action
with each element.action
- a consumer that is to be invoked with each
element in this Node.OfPrimitive
default T_NODE getChild(int i)
Node
Node
at a given index.T_NODE truncate(long from, long to, IntFunction<T[]> generator)
Node
truncate
in interface Node<T>
from
- The (inclusive) starting offset of elements to include, must
be in range 0..count().to
- The (exclusive) end offset of elements to include, must be
in range 0..count().generator
- A function to be used to create a new array, if needed,
for reference nodes.default T[] asArray(IntFunction<T[]> generator)
Depending on the underlying implementation, this may return a
reference to an internal array rather than a copy. Since the returned
array may be shared, the returned array should not be modified. The
generator
function may be consulted to create the array if a new
array needs to be created.
T_ARR asPrimitiveArray()
Depending on the underlying implementation this may return a reference to an internal array rather than a copy. It is the callers responsibility to decide if either this node or the array is utilized as the primary reference for the data.
Node
T_ARR newArray(int count)
count
- the length of the primitive array.void copyInto(T_ARR array, int offset)
Node
into a primitive array,
starting at a given offset into the array. It is the caller's
responsibility to ensure there is sufficient room in the array.array
- the array into which to copy the contents of this
Node
offset
- the starting offset within the arrayIndexOutOfBoundsException
- if copying would cause access of
data outside array boundsNullPointerException
- if array
is null