com.sun.electric.database.text
Class ImmutableArrayList<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.sun.electric.database.text.ImmutableArrayList<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 ImmutableArrayList<E>
extends java.util.ArrayList<E>

Constant-array implementation of the List interface.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ImmutableArrayList(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.
ImmutableArrayList(E[] a)
          Constructs a list containing the elements of the specified array.
ImmutableArrayList(E[] a, int fromIndex, int toIndex)
          Constructs a list containing the range of elements of the specified array.
 
Method Summary
 boolean add(E o)
           
 void add(int index, E element)
           
 boolean addAll(java.util.Collection<? extends E> c)
           
 boolean addAll(int index, java.util.Collection<? extends E> c)
           
 void clear()
           
 void ensureCapacity(int minCapacity)
           
 E remove(int index)
           
 boolean remove(java.lang.Object o)
           
protected  void removeRange(int fromIndex, int toIndex)
           
 E set(int index, E element)
           
 void trimToSize()
           
 ImmutableArrayList<E> with(E[] a)
           
 
Methods inherited from class java.util.ArrayList
clone, contains, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeAll, retainAll, size, subList, toArray, toArray
 
Methods inherited from class java.util.AbstractList
equals, hashCode
 
Methods inherited from class java.util.AbstractCollection
containsAll, 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
 

Constructor Detail

ImmutableArrayList

public ImmutableArrayList(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. The ImmutableArrayList instance has capacity of the size of the specified collection.

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

ImmutableArrayList

public ImmutableArrayList(E[] a)
Constructs a list containing the elements of the specified array. The ImmutableArrayList instance has capacity of the length of the specified array.

Parameters:
a - the array whose elements are to be placed into this list.
Throws:
java.lang.NullPointerException - if the specified array is null.

ImmutableArrayList

public ImmutableArrayList(E[] a,
                          int fromIndex,
                          int toIndex)
Constructs a list containing the range of elements of the specified array. The ImutableArrayList instance has capacity of the range length.

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

with

public ImmutableArrayList<E> with(E[] a)

trimToSize

public void trimToSize()
Overrides:
trimToSize in class java.util.ArrayList<E>

ensureCapacity

public void ensureCapacity(int minCapacity)
Overrides:
ensureCapacity in class java.util.ArrayList<E>

set

public E set(int index,
             E element)
Specified by:
set in interface java.util.List<E>
Overrides:
set in class java.util.ArrayList<E>

add

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

add

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

remove

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

remove

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

clear

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

addAll

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

addAll

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

removeRange

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