net.sf.molae.pipe.number
Class IntegerList
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<Integer>
net.sf.molae.pipe.number.IntegerList
- All Implemented Interfaces:
- Iterable<Integer>, Collection<Integer>, List<Integer>
public final class IntegerList
- extends AbstractList<Integer>
A list that contains all numbers between two limits in ascending order.
Member elements are not created during construction but only when
needed. Therefore subsequent calls of get will not return
the same objects.
|
Constructor Summary |
IntegerList(int from,
int to)
Creates a new list of integers containing all numbers including the
first parameter up to the second parameter (exclusive). |
| Methods inherited from class java.util.AbstractList |
add, add, addAll, clear, hashCode, iterator, listIterator, listIterator, remove, removeRange, set |
IntegerList
public IntegerList(int from,
int to)
- Creates a new list of integers containing all numbers including the
first parameter up to the second parameter (exclusive).
- Parameters:
from - the value of the first element of the new list.to - the value of the last element of the new list plus one.
- Throws:
IllegalArgumentException - if from > to
size
public int size()
- Specified by:
size in interface Collection<Integer>- Specified by:
size in interface List<Integer>- Specified by:
size in class AbstractCollection<Integer>
contains
public boolean contains(Object o)
- Specified by:
contains in interface Collection<Integer>- Specified by:
contains in interface List<Integer>- Overrides:
contains in class AbstractCollection<Integer>
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll in interface Collection<Integer>- Specified by:
containsAll in interface List<Integer>- Overrides:
containsAll in class AbstractCollection<Integer>
equals
public boolean equals(Object o)
- Specified by:
equals in interface Collection<Integer>- Specified by:
equals in interface List<Integer>- Overrides:
equals in class AbstractList<Integer>
get
public Integer get(int index)
- Returns the element at the specified position in this list.
- Specified by:
get in interface List<Integer>- Specified by:
get in class AbstractList<Integer>
- Parameters:
index - index of element to return.
- Returns:
- the element at the specified position in this list.
- Throws:
IndexOutOfBoundsException - if the index is out of range (index
< 0 || index >= size()).
indexOf
public int indexOf(Object o)
- Specified by:
indexOf in interface List<Integer>- Overrides:
indexOf in class AbstractList<Integer>
lastIndexOf
public int lastIndexOf(Object o)
- Specified by:
lastIndexOf in interface List<Integer>- Overrides:
lastIndexOf in class AbstractList<Integer>
subList
public List<Integer> subList(int fromIndex,
int toIndex)
- Returns a view of the portion of this list between the specified
fromIndex, inclusive, and toIndex, exclusive.
- Specified by:
subList in interface List<Integer>- Overrides:
subList in class AbstractList<Integer>
- Parameters:
fromIndex - low endpoint (inclusive) of the subList.toIndex - high endpoint (exclusive) of the subList.
- Returns:
- a view of the specified range within this list.
- Throws:
IndexOutOfBoundsException - for an illegal endpoint index value
(fromIndex < 0 || toIndex > size || fromIndex > toIndex).