public class TerminatedIntIterator extends Object implements IntIterator
This data structure is generally used for a sequence of namespace codes.
| Modifier and Type | Field and Description |
|---|---|
(package private) int |
index |
(package private) int |
terminator |
(package private) int[] |
values |
| Constructor and 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 and 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 IntIteratorpublic int next()
next in interface IntIterator