PrimitiveIterator
A base type for primitive specializations of Iterator. Specialized subtypes are provided for int, long, and double values.
The specialized subtype default implementations of Iterator.next and Iterator.forEachRemaining 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 should be used in preference to PrimitiveIterator.OfInt.next and PrimitiveIterator.OfInt.forEachRemaining.
Iteration of primitive values using boxing-based methods next() and Iterator.forEachRemaining, does not affect the order in which the values, transformed to boxed values, are encountered.
Since
1.8
Parameters
T, such as java.util.function.IntConsumer for Integer.