public class LongSequence extends BaseFieldGenerator<Long>
Long.| Constructor and Description |
|---|
LongSequence(long start,
long stop)
Build a sequence that will return values between
start and end (inclusive) with an increment of
1l. |
LongSequence(long start,
long stop,
long increment)
Build a sequence that will return values between
start and end (inclusive) with an increment of
increment. |
| Modifier and Type | Method and Description |
|---|---|
Long |
current()
Returns the current sequence value.
|
boolean |
hasNext()
Returns
true if the generator has more value to generate (In other words, returns true if
next would return a value rather than throwing an exception.) |
Long |
next()
Returns the next generated value.
|
void |
reset()
Resets the
LongSequence. |
String |
toString() |
removepublic LongSequence(long start,
long stop,
long increment)
start and end (inclusive) with an increment of
increment. For instance, in:
s1 = new LongSequence(1l, 10l, 2l);
s2 = new LongSequence(1l, 10l, 1l);
s1 will generate the following numbers: 1l, 3l, 5l, 7l, 9l and s2 will generate 1l, 2l, 3l, 4l,
5l, 6l, 7l, 8l, 9l, 10l.start - first value in sequence, inclusive.stop - last element in sequence, inclusive.increment - increment.IllegalArgumentException - if start is less than stop or if increment is less than or equal to 0.public LongSequence(long start,
long stop)
start and end (inclusive) with an increment of
1l.start - first value in sequence, inclusive.stop - last element in sequence, inclusive.LongSequence(long, long, long)public void reset()
public boolean hasNext()
true if the generator has more value to generate (In other words, returns true if
next would return a value rather than throwing an exception.)true if the iteration has more value.public Long next()
NoSuchElementException - if the iteration has no more value.public Long current()
next if next was never called before since
creation of last reset().Copyright © 2014. All Rights Reserved.