org.ujmp.core.collections
Class ArrayIndexList<M>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<M>
              extended by org.ujmp.core.collections.ArrayIndexList<M>
Type Parameters:
M - Type of the elements in the list
All Implemented Interfaces:
Serializable, Cloneable, Iterable<M>, Collection<M>, List<M>, RandomAccess

public class ArrayIndexList<M>
extends ArrayList<M>

ArrayIndexList is like an ArrayList, but keeps track of the indices where objects have been added. This improves the speed of indexOf() and contains()

Author:
Holger Arndt
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ArrayIndexList()
           
ArrayIndexList(Collection<? extends M> c)
           
 
Method Summary
 void add(int index, M element)
           
 boolean add(M e)
           
 boolean addAll(Collection<? extends M> c)
           
 boolean addAll(int index, Collection<? extends M> c)
           
 void clear()
           
 boolean contains(Object o)
           
 int indexOf(Object o)
           
 int lastIndexOf(Object o)
           
 M remove(int index)
           
 boolean remove(Object o)
           
 M set(int index, M element)
           
 
Methods inherited from class java.util.ArrayList
clone, ensureCapacity, get, isEmpty, removeRange, 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

ArrayIndexList

public ArrayIndexList()

ArrayIndexList

public ArrayIndexList(Collection<? extends M> c)
Method Detail

add

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

add

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

addAll

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

addAll

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

clear

public void clear()
Specified by:
clear in interface Collection<M>
Specified by:
clear in interface List<M>
Overrides:
clear in class ArrayList<M>

contains

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

indexOf

public int indexOf(Object o)
Specified by:
indexOf in interface List<M>
Overrides:
indexOf in class ArrayList<M>

lastIndexOf

public int lastIndexOf(Object o)
Specified by:
lastIndexOf in interface List<M>
Overrides:
lastIndexOf in class ArrayList<M>

remove

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

remove

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

set

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


Copyright © 2010. All Rights Reserved.