com.threerings.opengl.model.tools
Class ModelDef.HashArrayList<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<E>
              extended by com.threerings.opengl.model.tools.ModelDef.HashArrayList<E>
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, List<E>, RandomAccess
Enclosing class:
ModelDef

protected static class ModelDef.HashArrayList<E>
extends ArrayList<E>

Accelerates ArrayList.indexOf(java.lang.Object), ArrayList.contains(java.lang.Object), and ArrayList.remove(int) using an internal hash map (assumes that all elements of the list are unique and non-null).

See Also:
Serialized Form

Field Summary
protected  HashMap<Object,Integer> _indices
          Maps elements to their indices in the list.
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
protected ModelDef.HashArrayList()
           
 
Method Summary
 boolean add(E element)
           
 void add(int idx, E element)
           
 void clear()
           
 boolean contains(Object obj)
           
 int indexOf(Object obj)
           
protected  void remapFrom(int idx)
           
 E remove(int idx)
           
 boolean remove(Object obj)
           
 
Methods inherited from class java.util.ArrayList
addAll, addAll, clone, ensureCapacity, get, isEmpty, lastIndexOf, 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
 

Field Detail

_indices

protected HashMap<Object,Integer> _indices
Maps elements to their indices in the list.

Constructor Detail

ModelDef.HashArrayList

protected ModelDef.HashArrayList()
Method Detail

add

public boolean add(E element)
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 idx,
                E element)
Specified by:
add in interface List<E>
Overrides:
add in class ArrayList<E>

remove

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

clear

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

indexOf

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

contains

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

remove

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

remapFrom

protected void remapFrom(int idx)