|
FlexDoc/Javadoc 2.0 Demo Java Doc |
The specialized subtype default implementations of Iterator.next() and Iterator.forEachRemaining(java.util.function.Consumer) 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.OfInt.nextInt() and PrimitiveIterator.OfInt.forEachRemaining(java.util.function.IntConsumer) should be used in preference to PrimitiveIterator.OfInt.next() and PrimitiveIterator.OfInt.forEachRemaining(java.util.function.Consumer).
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.
Nested Class Summary |
||
static interface |
An Iterator specialized for double values.
|
|
static interface |
An Iterator specialized for int values.
|
|
static interface |
An Iterator specialized for long values.
|
Method Summary |
||
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.
|
Methods inherited from interface java.util.Iterator |
void forEachRemaining |
(T_CONS action) |
The behavior of an iterator is unspecified if the action modifies the source of elements in any way (even by calling the remove method or other mutator methods of Iterator subtypes), unless an overriding class has specified a concurrent modification policy.
Subsequent behavior of an iterator is unspecified if the action throws an exception.
|
FlexDoc/Javadoc 2.0 Demo Java Doc |