net.ericaro.neoitertools.generators
Class RangeGenerator
java.lang.Object
net.ericaro.neoitertools.generators.RangeGenerator
- All Implemented Interfaces:
- Generator<java.lang.Integer>
public class RangeGenerator
- extends java.lang.Object
- implements Generator<java.lang.Integer>
This is a versatile Generator containing arithmetic progressions. It is most
often used in for loops. The full form returns an iterator over Integers
[start, start + step, start + 2 * step, ...].
- If step is positive, the last element is the largest start + i * step
less than stop;
- if step is negative, the last element is the smallest start + i * step
greater than stop.
- step must not be zero (or else InvalidParameterException is raised).
Example:
- Author:
- eric
- See Also:
-
RangeGenerator's wiki page,
neoitertools site
|
Method Summary |
java.lang.Integer |
next()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RangeGenerator
public RangeGenerator(int start,
int end)
RangeGenerator
public RangeGenerator(int end)
RangeGenerator
public RangeGenerator(int start,
int end,
int step)
next
public java.lang.Integer next()
- Specified by:
next in interface Generator<java.lang.Integer>
- Returns:
- the next item in the sequence.
Copyright © 2011. All Rights Reserved.