Integer for the primitive int type.
java.util.function.Consumer for
T, such as java.util.function.IntConsumer for
Integer.
Iterator. Specialized
subtypes are provided for int, long, and
double values.
The specialized subtype default implementations of Iterator#next
and Iterator#forEachRemaining(java. box
primitive values to instances of their corresponding wrapper class. Such
boxing may offset any advantages gained when using the primitive
specializations. To avoid boxing, the corresponding primitive-based methods
should be used. For example, PrimitiveIterator. and
PrimitiveIterator.
should be used in preference to PrimitiveIterator. and
PrimitiveIterator..
Iteration of primitive values using boxing-based methods
next() and
forEachRemaining(),
does not affect the order in which the values, transformed to boxed values,
are encountered.
Implementation Note
If the boolean system property org.openjdk.java.util.stream.tripwire
is set to true then diagnostic warnings are reported if boxing of
primitive values occur when operating on primitive subtype specializations.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | PrimitiveIterator.
An Iterator specialized for |
| public static interface | PrimitiveIterator.
An Iterator specialized for |
| public static interface | PrimitiveIterator.
An Iterator specialized for |
| Modifier and Type | Method and Description |
|---|---|
| public void | forEachRemaining(T_CONS
The action to be performed for each element action)Performs the given action for each remaining element until all elements have been processed or the action throws an exception. |
| forEachRemaining | back to summary |
|---|---|
| public void forEachRemaining(T_CONS action) Performs the given action for each remaining element until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.
The behavior of an iterator is unspecified if the action modifies the
source of elements in any way (even by calling the Subsequent behavior of an iterator is unspecified if the action throws an exception.
| |
double values.
| Modifier and Type | Method and Description |
|---|---|
| public default void | forEachRemaining(DoubleConsumer action)
Implements java. Performs the given action for each remaining element until all elements have been processed or the action throws an exception. |
| public default void | forEachRemaining(Consumer<? super Double> action)
Implements java. Performs the given action for each remaining element until all elements have been processed or the action throws an exception. |
| public default Double | |
| public double | Returns: the nextdouble element in the iterationReturns the next |
| forEachRemaining | back to summary |
|---|---|
| public default void forEachRemaining(DoubleConsumer action) Implements java. Doc from java. Performs the given action for each remaining element until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.
The behavior of an iterator is unspecified if the action modifies the
source of elements in any way (even by calling the Subsequent behavior of an iterator is unspecified if the action throws an exception. Implementation Specification The default implementation behaves as if:
| |
| forEachRemaining | back to summary |
|---|---|
| public default void forEachRemaining(Consumer<? super Double> action) Implements java. Doc from java. Performs the given action for each remaining element until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.
The behavior of an iterator is unspecified if the action modifies the
source of elements in any way (even by calling the Subsequent behavior of an iterator is unspecified if the action throws an exception. Implementation Specification If the action is an instance of
| |
| next | back to summary |
|---|---|
| public default Double next() Implements java. Doc from java. Returns the next element in the iteration. Implementation Specification The default implementation boxes the result of calling
| |
| nextDouble | back to summary |
|---|---|
| public double nextDouble() Returns the next
| |
int values.
| Modifier and Type | Method and Description |
|---|---|
| public default void | forEachRemaining(IntConsumer action)
Implements java. Performs the given action for each remaining element until all elements have been processed or the action throws an exception. |
| public default void | forEachRemaining(Consumer<? super Integer> action)
Implements java. Performs the given action for each remaining element until all elements have been processed or the action throws an exception. |
| public default Integer | |
| public int | Returns: the nextint element in the iterationReturns the next |
| forEachRemaining | back to summary |
|---|---|
| public default void forEachRemaining(IntConsumer action) Implements java. Doc from java. Performs the given action for each remaining element until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.
The behavior of an iterator is unspecified if the action modifies the
source of elements in any way (even by calling the Subsequent behavior of an iterator is unspecified if the action throws an exception. Implementation Specification The default implementation behaves as if:
| |
| forEachRemaining | back to summary |
|---|---|
| public default void forEachRemaining(Consumer<? super Integer> action) Implements java. Doc from java. Performs the given action for each remaining element until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.
The behavior of an iterator is unspecified if the action modifies the
source of elements in any way (even by calling the Subsequent behavior of an iterator is unspecified if the action throws an exception. Implementation Specification If the action is an instance of
| |
| next | back to summary |
|---|---|
| public default Integer next() Implements java. Doc from java. Returns the next element in the iteration. Implementation Specification The default implementation boxes the result of calling
| |
| nextInt | back to summary |
|---|---|
| public int nextInt() Returns the next
| |
long values.
| Modifier and Type | Method and Description |
|---|---|
| public default void | forEachRemaining(LongConsumer action)
Implements java. Performs the given action for each remaining element until all elements have been processed or the action throws an exception. |
| public default void | forEachRemaining(Consumer<? super Long> action)
Implements java. Performs the given action for each remaining element until all elements have been processed or the action throws an exception. |
| public default Long | |
| public long | Returns: the nextlong element in the iterationReturns the next |
| forEachRemaining | back to summary |
|---|---|
| public default void forEachRemaining(LongConsumer action) Implements java. Doc from java. Performs the given action for each remaining element until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.
The behavior of an iterator is unspecified if the action modifies the
source of elements in any way (even by calling the Subsequent behavior of an iterator is unspecified if the action throws an exception. Implementation Specification The default implementation behaves as if:
| |
| forEachRemaining | back to summary |
|---|---|
| public default void forEachRemaining(Consumer<? super Long> action) Implements java. Doc from java. Performs the given action for each remaining element until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.
The behavior of an iterator is unspecified if the action modifies the
source of elements in any way (even by calling the Subsequent behavior of an iterator is unspecified if the action throws an exception. Implementation Specification If the action is an instance of
| |
| next | back to summary |
|---|---|
| public default Long next() Implements java. Doc from java. Returns the next element in the iteration. Implementation Specification The default implementation boxes the result of calling
| |
| nextLong | back to summary |
|---|---|
| public long nextLong() Returns the next
| |