IntIterator
public class TerminatedIntIterator extends java.lang.Object implements IntIterator
This data structure is generally used for a sequence of namespace codes.
Constructor | Description |
---|---|
TerminatedIntIterator(int[] values) |
Construct an iterator over a sequence of integers held in an array, with
the value -1 acting as the terminator
|
TerminatedIntIterator(int[] values,
int terminator) |
Construct an iterator over a sequence of integers held in an array, with
a specified value acting as the terminator
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
hasNext() |
Test whether there are any more integers in the sequence
|
int |
next() |
Return the next integer in the sequence.
|
public TerminatedIntIterator(int[] values)
values
- the sequence of integerspublic TerminatedIntIterator(int[] values, int terminator)
values
- the sequence of integersterminator
- the terminator valuepublic boolean hasNext()
hasNext
in interface IntIterator
public int next()
next
in interface IntIterator