TSim
Class AddingArrayList<E>

java.lang.Object
  extended by TSim.AddingArrayList<E>

public class AddingArrayList<E>
extends java.lang.Object

Maintains an ArrayList of elements of type E, with size increased as needed. Difference to ArrayList's methods are
- ArrayIndexOutOfBoundException is not thrown when index >= size; instead size is increased and array filled with null's.
- Methods are synchronized.


Constructor Summary
AddingArrayList()
          Creates an ArrayList using default constructor.
 
Method Summary
 E get(int index)
          Returns element at position index.
 void set(int index, E elem)
          Assigns elem at position index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddingArrayList

public AddingArrayList()
Creates an ArrayList using default constructor.

Method Detail

set

public void set(int index,
                E elem)
Assigns elem at position index. if needed, size is expanded to be at least index+1.


get

public E get(int index)
Returns element at position index. If necessary, array is first expanded to size at least index+1.