Package net.sf.saxon.z
Class IntStepIterator
java.lang.Object
net.sf.saxon.z.IntStepIterator
- All Implemented Interfaces:
IntIterator
An iterator over a sequence of integers with regular steps, e.g. 2, 4, 6, 8...
-
Constructor Summary
ConstructorsConstructorDescriptionIntStepIterator(int start, int step, int limit) Create an iterator over a sequence with regular steps -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNext()Test whether there are any more integers in the sequence; and change the state of the iterator so a call onIntIterator.next()delivers the next integer.intnext()Return the next integer in the sequence.
-
Constructor Details
-
IntStepIterator
public IntStepIterator(int start, int step, int limit) Create an iterator over a sequence with regular steps- Parameters:
start- the first value to be returnedstep- the difference between successive values (must be non-zero)limit- if step>0, the iteration will not deliver any values greater than this limit; if step<0 the iteration will not deliver any values lower than this limit
-
-
Method Details
-
hasNext
public boolean hasNext()Description copied from interface:IntIteratorTest whether there are any more integers in the sequence; and change the state of the iterator so a call onIntIterator.next()delivers the next integer.The effect of calling
#hasNext()a second time without an intervening call on#next()is undefined.- Specified by:
hasNextin interfaceIntIterator- Returns:
- true if there are more integers to come
-
next
public int next()Description copied from interface:IntIteratorReturn the next integer in the sequence. The result is undefined unless#hasNext()has been called and has returned true.- Specified by:
nextin interfaceIntIterator- Returns:
- the next integer in the sequence
-