org.deri.iris.utils
Class UniqueList<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.deri.iris.utils.UniqueList<E>
Type Parameters:
E - The type of the elements of this collection.
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, List<E>, RandomAccess

public class UniqueList<E>
extends ArrayList<E>

Modified array list implementation that enforces uniqueness, but maintains ordering.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
UniqueList()
          Default constructor.
UniqueList(int initialCapacity)
          Constructor.
 
Method Summary
 boolean add(E o)
           
 void add(int index, E element)
           
 boolean addAll(Collection<? extends E> c)
           
 boolean addAll(int index, Collection<? extends E> c)
           
 boolean contains(Object element)
           
 Iterator<E> iterator()
           
 ListIterator<E> listIterator()
           
 ListIterator<E> listIterator(int index)
           
 E remove(int index)
           
 boolean remove(Object o)
           
protected  void removeRange(int fromIndex, int toIndex)
           
 E set(int index, E newElement)
           
 
Methods inherited from class java.util.ArrayList
clear, clone, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, 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, removeAll, retainAll, subList
 

Constructor Detail

UniqueList

public UniqueList(int initialCapacity)
Constructor.

Parameters:
initialCapacity - Space for this many elements is reserved.

UniqueList

public UniqueList()
Default constructor.

Method Detail

add

public boolean add(E o)
Specified by:
add in interface Collection<E>
Specified by:
add in interface List<E>
Overrides:
add in class ArrayList<E>

add

public void add(int index,
                E element)
Specified by:
add in interface List<E>
Overrides:
add in class ArrayList<E>

addAll

public boolean addAll(Collection<? extends E> c)
Specified by:
addAll in interface Collection<E>
Specified by:
addAll in interface List<E>
Overrides:
addAll in class ArrayList<E>

addAll

public boolean addAll(int index,
                      Collection<? extends E> c)
Specified by:
addAll in interface List<E>
Overrides:
addAll in class ArrayList<E>

remove

public E remove(int index)
Specified by:
remove in interface List<E>
Overrides:
remove in class ArrayList<E>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<E>
Specified by:
remove in interface List<E>
Overrides:
remove in class ArrayList<E>

removeRange

protected void removeRange(int fromIndex,
                           int toIndex)
Overrides:
removeRange in class ArrayList<E>

set

public E set(int index,
             E newElement)
Specified by:
set in interface List<E>
Overrides:
set in class ArrayList<E>

contains

public boolean contains(Object element)
Specified by:
contains in interface Collection<E>
Specified by:
contains in interface List<E>
Overrides:
contains in class ArrayList<E>

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface List<E>
Overrides:
iterator in class AbstractList<E>

listIterator

public ListIterator<E> listIterator()
Specified by:
listIterator in interface List<E>
Overrides:
listIterator in class AbstractList<E>

listIterator

public ListIterator<E> listIterator(int index)
Specified by:
listIterator in interface List<E>
Overrides:
listIterator in class AbstractList<E>