public abstract static class Iterators.PrimitiveInt extends Object implements Iterator<Integer>
Iterators.PrimitiveInt is an integer iterator that
also allows objects to be accessed as primitive int
values.
The method next() returns an Integer,
whereas nextPrimitive() returns a primitive int value. Using either one will advanced the iterator to the
next element.
Implementation Note: Using the standard iterator
implementation as Integer requires boxing of the
primitive values as objects. Therefore, use the method
nextPrimitive() wherever possible.
| Constructor and Description |
|---|
PrimitiveInt() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
hasNext()
Returns
true if there is another integer in the
iteration. |
Integer |
next()
Returns the next integer result.
|
abstract int |
nextPrimitive()
Returns the next primitive integer.
|
void |
remove()
Throws unsupported operation exception.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic abstract int nextPrimitive()
public abstract boolean hasNext()
true if there is another integer in the
iteration.public void remove()
remove in interface Iterator<Integer>UnsupportedOperationException - Always.public Integer next()
Implementation Note: Requires boxing the
primitive int returned by nextPrimitive().
Copyright © 2019 Alias-i, Inc.. All rights reserved.