T.
A Node contains a fixed number of elements, which can be accessed
via the count, spliterator, forEach,
asArray, or copyInto methods. A Node may have zero
or more child Nodes; if it has no children (accessed via
getChildCount and getChild(int), it is considered flat
or a leaf; if it has children, it is considered an
internal node. The size of an internal node is the sum of sizes of
its children.
API Note
A Node typically does not store the elements directly, but instead
mediates access to one or more existing (effectively immutable) data
structures such as a Collection, array, or a set of other
Nodes. Commonly Nodes are formed into a tree whose shape
corresponds to the computation tree that produced the elements that are
contained in the leaf nodes. The use of Node within the stream
framework is largely to avoid copying data unnecessarily during parallel
operations.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | Node.
A mutable builder for a |
| public static interface | Node.
Specialized |
| public static interface | Node.
Specialized |
| public static interface | Node.
Specialized |
| public static interface | Node.
|
| Modifier and Type | Method and Description |
|---|---|
| public T[] | Returns: an array containing the contents of thisNodea factory function which takes an integer parameter and
returns a new, empty array of that size and of the appropriate
array type generator)Provides an array view of the contents of this node. |
| public void | copyInto(T[]
the array into which to copy the contents of this
array, int Nodethe starting offset within the array offset)Copies the content of this |
| public long | Returns: the number of elements contained in this nodeReturns the number of elements contained in this node. |
| public void | |
| public default Node | Returns: the child nodethe index to the child node i)Retrieves the child |
| public default int | |
| public default StreamShape | Returns: the stream shape associated with this nodeGets the |
| public Spliterator | Returns: aSpliterator describing the elements contained in this
NodeReturns a |
| public default Node | Returns: the truncated nodeThe (inclusive) starting offset of elements to include, must
be in range 0..count(). from, long The (exclusive) end offset of elements to include, must be
in range 0..count(). to, IntFunction<T[]> A function to be used to create a new array, if needed,
for reference nodes. 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. |
| asArray | back to summary |
|---|---|
| public T[] asArray(IntFunction<T[]> generator) Provides an array view of the contents of this node. 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
| |
| copyInto | back to summary |
|---|---|
| public void copyInto(T[] array, int offset) Copies the content of this
| |
| count | back to summary |
|---|---|
| public long count() Returns the number of elements contained in this node.
| |
| forEach | back to summary |
|---|---|
| public void forEach(Consumer<? super T> consumer) Traverses the elements of this node, and invoke the provided
| |
| getChild | back to summary |
|---|---|
| public default Node Retrieves the child Implementation Specification The default implementation always throws
| |
| getChildCount | back to summary |
|---|---|
| public default int getChildCount() Returns the number of child nodes of this node. Implementation Specification The default implementation returns zero.
| |
| getShape | back to summary |
|---|---|
| public default StreamShape getShape() Gets the Implementation Specification The default in
| |
| spliterator | back to summary |
|---|---|
| public Spliterator Returns a
| |
| truncate | back to summary |
|---|---|
| public default Node 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.
| |
Node that implements Sink, which
builds a flat node containing the elements that have been pushed to it.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | Node.
Specialized |
| public static interface | Node.
Specialized |
| public static interface | Node.
Specialized |
| Modifier and Type | Method and Description |
|---|---|
| public Node |
| build | back to summary |
|---|---|
| public Node Builds the node. Should be called after all elements have been
pushed and signalled with an invocation of
| |
Node.Builder for double elements
| Modifier and Type | Method and Description |
|---|---|
| public Node. |
| build | back to summary |
|---|---|
| public Node. Redeclares java. Doc from java. Builds the node. Should be called after all elements have been
pushed and signalled with an invocation of
| |
Node.Builder for int elements
| Modifier and Type | Method and Description |
|---|---|
| public Node. |
| build | back to summary |
|---|---|
| public Node. Redeclares java. Doc from java. Builds the node. Should be called after all elements have been
pushed and signalled with an invocation of
| |
Node.Builder for long elements
| Modifier and Type | Method and Description |
|---|---|
| public Node. |
| build | back to summary |
|---|---|
| public Node. Redeclares java. Doc from java. Builds the node. Should be called after all elements have been
pushed and signalled with an invocation of
| |
Node for double elements
| Modifier and Type | Method and Description |
|---|---|
| public default void | copyInto(Double[] boxed, int offset)
Implements java. Copies the content of this |
| public default void | forEach(Consumer<? super Double>
A consumer)Consumer that is to be invoked with each
element in this Node. If this is an
DoubleConsumer, it is cast to DoubleConsumer
so the elements may be processed without boxing.Implements java. Traverses the elements of this node, and invoke the provided
|
| public default StreamShape | getShape()
Overrides default java. Gets the |
| public default double[] | newArray(int count)
Implements java. Creates a new primitive array. |
| public default Node. | truncate(long from, long to, IntFunction<Double[]> generator)
Implements java. 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. |
| copyInto | back to summary |
|---|---|
| public default void copyInto(Double[] boxed, int offset) Implements java. Doc from java. Copies the content of this Implementation Specification the default implementation invokes
| |
| forEach | back to summary |
|---|---|
| public default void forEach(Consumer<? super Double> consumer) Implements java. Doc from java. Traverses the elements of this node, and invoke the provided
| |
| getShape | back to summary |
|---|---|
| public default StreamShape getShape() Overrides default java. Doc from java. Gets the Implementation Specification The default in | |
| newArray | back to summary |
|---|---|
| public default double[] newArray(int count) Implements java. Doc from java. Creates a new primitive array.
| |
| truncate | back to summary |
|---|---|
| public default Node. Implements java. Doc from java. 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.
| |
Node for int elements
| Modifier and Type | Method and Description |
|---|---|
| public default void | copyInto(Integer[] boxed, int offset)
Implements java. Copies the content of this |
| public default void | forEach(Consumer<? super Integer>
a consumer)Consumer that is to be invoked with each
element in this Node. If this is an
IntConsumer, it is cast to IntConsumer so the
elements may be processed without boxing.Implements java. Traverses the elements of this node, and invoke the provided
|
| public default StreamShape | getShape()
Overrides default java. Gets the |
| public default int[] | newArray(int count)
Implements java. Creates a new primitive array. |
| public default Node. | truncate(long from, long to, IntFunction<Integer[]> generator)
Implements java. 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. |
| copyInto | back to summary |
|---|---|
| public default void copyInto(Integer[] boxed, int offset) Implements java. Doc from java. Copies the content of this Implementation Specification the default implementation invokes
| |
| forEach | back to summary |
|---|---|
| public default void forEach(Consumer<? super Integer> consumer) Implements java. Doc from java. Traverses the elements of this node, and invoke the provided
| |
| getShape | back to summary |
|---|---|
| public default StreamShape getShape() Overrides default java. Doc from java. Gets the Implementation Specification The default in | |
| newArray | back to summary |
|---|---|
| public default int[] newArray(int count) Implements java. Doc from java. Creates a new primitive array.
| |
| truncate | back to summary |
|---|---|
| public default Node. Implements java. Doc from java. 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.
| |
Node for long elements
| Modifier and Type | Method and Description |
|---|---|
| public default void | copyInto(Long[] boxed, int offset)
Implements java. Copies the content of this |
| public default void | forEach(Consumer<? super Long>
A consumer)Consumer that is to be invoked with each
element in this Node. If this is an
LongConsumer, it is cast to LongConsumer so
the elements may be processed without boxing.Implements java. Traverses the elements of this node, and invoke the provided
|
| public default StreamShape | getShape()
Overrides default java. Gets the |
| public default long[] | newArray(int count)
Implements java. Creates a new primitive array. |
| public default Node. | truncate(long from, long to, IntFunction<Long[]> generator)
Implements java. 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. |
| copyInto | back to summary |
|---|---|
| public default void copyInto(Long[] boxed, int offset) Implements java. Doc from java. Copies the content of this Implementation Specification the default implementation invokes
| |
| forEach | back to summary |
|---|---|
| public default void forEach(Consumer<? super Long> consumer) Implements java. Doc from java. Traverses the elements of this node, and invoke the provided
| |
| getShape | back to summary |
|---|---|
| public default StreamShape getShape() Overrides default java. Doc from java. Gets the Implementation Specification The default in | |
| newArray | back to summary |
|---|---|
| public default long[] newArray(int count) Implements java. Doc from java. Creates a new primitive array.
| |
| truncate | back to summary |
|---|---|
| public default Node. Implements java. Doc from java. 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.
| |
| Modifier and Type | Method and Description |
|---|---|
| public default T[] | asArray(IntFunction<T[]> generator)
Implements java. Provides an array view of the contents of this node. |
| public T_ARR | Returns: an array containing the contents of thisNodeViews this node as a primitive array. |
| public void | copyInto(T_ARR
the array into which to copy the contents of this
array, int Nodethe starting offset within the array offset)Copies the content of this |
| public void | forEach(T_CONS
a consumer that is to be invoked with each
element in this action)Node.OfPrimitiveTraverses the elements of this node, and invoke the provided
|
| public default T_NODE | getChild(int i)
Overrides default java. Retrieves the child |
| public T_ARR | Returns: the new primitive array.the length of the primitive array. count)Creates a new primitive array. |
| public T_SPLITR | Returns: aSpliterator. describing the elements of
this nodeRedeclares java. Returns a |
| public T_NODE | truncate(long from, long to, IntFunction<T[]> generator)
Redeclares as abstract: java. 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. |
| asArray | back to summary |
|---|---|
| public default T[] asArray(IntFunction<T[]> generator) Implements java. Doc from java. Provides an array view of the contents of this node. 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
Implementation Specification the default implementation invokes the generator to create
an instance of a boxed primitive array with a length of
| |
| asPrimitiveArray | back to summary |
|---|---|
| public T_ARR asPrimitiveArray() Views this node as a primitive array. 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.
| |
| copyInto | back to summary |
|---|---|
| public void copyInto(T_ARR array, int offset) Copies the content of this
| |
| forEach | back to summary |
|---|---|
| public void forEach(T_CONS action) Traverses the elements of this node, and invoke the provided
| |
| getChild | back to summary |
|---|---|
| public default T_NODE getChild(int i) Overrides default java. Doc from java. Retrieves the child
| |
| newArray | back to summary |
|---|---|
| public T_ARR newArray(int count) Creates a new primitive array.
| |
| spliterator | back to summary |
|---|---|
| public T_SPLITR spliterator() Redeclares java. Doc from java. Returns a
| |
| truncate | back to summary |
|---|---|
| public T_NODE truncate(long from, long to, IntFunction<T[]> generator) Redeclares as abstract: java. Doc from java. 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. | |