start up to end with an increment of step.
The value of start is always included.
The value of end is included only if the difference between end-start is a multiple of step.
The step can be positive or negative, but never 0. It must have the same signum as of end-start.
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final int | |
| private final int |
| Access | Constructor and Description |
|---|---|
| public | IntegerRange(int
the start value (inclusive) start, int the end value (inclusive) end)Constructs a new IntegerRange object. |
| public | IntegerRange(int
the start value (inclusive) start, int the end value (inclusive if end-start%step == 0) end, int the increment step)Constructs a new IntegerRange object. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: whether this sequence contains the given number or not.the number to be checked for containment. number)Checks whether this contains the given number, i.e. whether the iterator will yield the number. |
| public int | |
| public int | Returns: the number of elements in this IntegerRange.Returns the number of elements in this IntegerRange. |
| public int | |
| public int | |
| public ListIterator | Returns: a read-onlyListIterator for this.Implements java. Returns an iterator over elements of type |
| public IntegerRange |
| end | back to summary |
|---|---|
| private final int end | |
| start | back to summary |
|---|---|
| private final int start | |
| step | back to summary |
|---|---|
| private final int step | |
| IntegerRange | back to summary |
|---|---|
| public IntegerRange(int start, int end) Constructs a new IntegerRange object. The step will be set to -1 if end<start or to 1 otherwise.
| |
| IntegerRange | back to summary |
|---|---|
| public IntegerRange(int start, int end, int step) Constructs a new IntegerRange object.
| |
| contains | back to summary |
|---|---|
| public boolean contains(int number) Checks whether this contains the given number, i.e. whether the iterator will yield the number. This is different
from interval containment:
| |
| getEnd | back to summary |
|---|---|
public int getEnd()
| |
| getSize | back to summary |
|---|---|
| public int getSize() Returns the number of elements in this IntegerRange. That is not the length of the interval,
but
| |
| getStart | back to summary |
|---|---|
public int getStart()
| |
| getStep | back to summary |
|---|---|
public int getStep()
| |
| iterator | back to summary |
|---|---|
| public ListIterator Implements java. Doc from java. Returns an iterator over elements of type
| |
| withStep | back to summary |
|---|---|
public IntegerRange withStep(int step)
| |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(Integer e)
Implements java. Inserts the specified element into the list (optional operation). |
| public boolean | hasNext()
Implements java. Returns |
| public boolean | hasPrevious()
Implements java. Returns |
| public Integer | next()
Implements java. Returns the next element in the list and advances the cursor position. |
| public int | nextIndex()
Implements java. Returns the index of the element that would be returned by a
subsequent call to |
| public Integer | previous()
Implements java. Returns the previous element in the list and moves the cursor position backwards. |
| public int | previousIndex()
Implements java. Returns the index of the element that would be returned by a
subsequent call to |
| public void | remove()
Implements java. Removes from the list the last element that was returned by |
| public void | set(Integer e)
Implements java. Replaces the last element returned by |
| RangeIterator | back to summary |
|---|---|
| private RangeIterator() | |
| add | back to summary |
|---|---|
| public void add(Integer e) Implements java. Doc from java. Inserts the specified element into the list (optional operation).
The element is inserted immediately before the element that
would be returned by
| |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| hasPrevious | back to summary |
|---|---|
| public boolean hasPrevious() Implements java. Doc from java. Returns
| |
| next | back to summary |
|---|---|
| public Integer next() Implements java. Doc from java. Returns the next element in the list and advances the cursor position.
This method may be called repeatedly to iterate through the list,
or intermixed with calls to
| |
| nextIndex | back to summary |
|---|---|
| public int nextIndex() Implements java. Doc from java. Returns the index of the element that would be returned by a
subsequent call to
| |
| previous | back to summary |
|---|---|
| public Integer previous() Implements java. Doc from java. Returns the previous element in the list and moves the cursor
position backwards. This method may be called repeatedly to
iterate through the list backwards, or intermixed with calls to
| |
| previousIndex | back to summary |
|---|---|
| public int previousIndex() Implements java. Doc from java. Returns the index of the element that would be returned by a
subsequent call to
| |
| remove | back to summary |
|---|---|
| public void remove() Implements java. Doc from java. Removes from the list the last element that was returned by
| |
| set | back to summary |
|---|---|
| public void set(Integer e) Implements java. Doc from java. Replaces the last element returned by
| |