net.sf.molae.pipe.number
Class IntegerList

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--net.sf.molae.pipe.number.IntegerList
All Implemented Interfaces:
Collection, List

public final class IntegerList
extends AbstractList

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 retur the same objects.


Fields inherited from class java.util.AbstractList
modCount
 
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).
 
Method Summary
 boolean contains(Object o)
           
 boolean containsAll(Collection c)
           
 boolean equals(Object o)
           
 Object get(int index)
          Returns the element at the specified position in this list.
 int indexOf(Object o)
           
 int lastIndexOf(Object o)
           
 int size()
           
 List subList(int fromIndex, int toIndex)
          Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, hashCode, iterator, listIterator, listIterator, remove, removeRange, set
 
Methods inherited from class java.util.AbstractCollection
addAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

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
Method Detail

size

public int size()
Overrides:
size in class AbstractCollection

contains

public boolean contains(Object o)
Overrides:
contains in class AbstractCollection

containsAll

public boolean containsAll(Collection c)
Overrides:
containsAll in class AbstractCollection

equals

public boolean equals(Object o)
Overrides:
equals in class AbstractList

get

public Object get(int index)
Returns the element at the specified position in this list.
Overrides:
get in class AbstractList
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)
Overrides:
indexOf in class AbstractList

lastIndexOf

public int lastIndexOf(Object o)
Overrides:
lastIndexOf in class AbstractList

subList

public List subList(int fromIndex,
                    int toIndex)
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
Overrides:
subList in class AbstractList
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).