org.formaria.util
Class IndexedArrayList<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<E>
              extended by org.formaria.util.IndexedArrayList<E>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, java.util.RandomAccess

public class IndexedArrayList<E>
extends java.util.ArrayList<E>

An extension of ArrayList that supports an 'index' value. A shared index can be used by this class. For licensing information see license.txt

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
IndexedArrayList()
          Constructs an empty list with an initial capacity of ten.
IndexedArrayList(java.util.Collection<? extends E> c)
          Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator.
IndexedArrayList(IndexedArrayList<E> list)
          Constructs an empty list with an initial capacity of ten and using the same index as referenced list
IndexedArrayList(int initialCapacity)
          Constructs an empty list with the specified initial capacity.
 
Method Summary
 void first()
          Go to the first index position
 E getCurrentItem()
          Get the 'current' item in the list
 int getIndex()
          Get the index of the currently 'selected' object in the list
 void last()
          Go to the last index position
 void next()
          Go to the next index
 void prev()
          Go to the previous index
 void setIndex(int idx)
          Set the index of the currently 'selected' object in the list
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

IndexedArrayList

public IndexedArrayList()
Constructs an empty list with an initial capacity of ten.


IndexedArrayList

public IndexedArrayList(int initialCapacity)
Constructs an empty list with the specified initial capacity.

Parameters:
initialCapacity - the initial capacity of the list
Throws:
java.lang.IllegalArgumentException - if the specified initial capacity is negative

IndexedArrayList

public IndexedArrayList(IndexedArrayList<E> list)
Constructs an empty list with an initial capacity of ten and using the same index as referenced list


IndexedArrayList

public IndexedArrayList(java.util.Collection<? extends E> c)
Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator.

Parameters:
c - the collection whose elements are to be placed into this list
Throws:
java.lang.NullPointerException - if the specified collection is null
Method Detail

getIndex

public int getIndex()
Get the index of the currently 'selected' object in the list

Returns:

setIndex

public void setIndex(int idx)
Set the index of the currently 'selected' object in the list

Parameters:
idx - the new selection index

first

public void first()
Go to the first index position


last

public void last()
Go to the last index position


next

public void next()
Go to the next index


prev

public void prev()
Go to the previous index


getCurrentItem

public E getCurrentItem()
Get the 'current' item in the list

Returns:
the current item