Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.util
Class Arrays.ArrayList  view Arrays.ArrayList download Arrays.ArrayList.java

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.Arrays.ArrayList
All Implemented Interfaces:
Collection, java.lang.Iterable, List, RandomAccess, java.io.Serializable
Enclosing class:
Arrays

private static final class Arrays.ArrayList
extends AbstractList
implements java.io.Serializable, RandomAccess

Inner class used by Arrays.asList(Object[]) 55 to provide a list interface to an array. The name, though it clashes with java.util.ArrayList, is Sun's choice for Serialization purposes. Element addition and removal is prohibited, but values can be modified.


Nested Class Summary
 
Nested classes inherited from class java.util.AbstractList
 
Field Summary
private  java.lang.Object[] a
          The array we are viewing.
private static long serialVersionUID
          Compatible with JDK 1.4.
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
(package private) Arrays.ArrayList(java.lang.Object[] a)
          Construct a list view of the array.
 
Method Summary
 boolean contains(java.lang.Object o)
          Returns true if the array contains the supplied object.
 java.lang.Object get(int index)
          Returns the object at the specified index in the array.
 int indexOf(java.lang.Object o)
          Returns the first index at which the object, o, occurs in the array.
 int lastIndexOf(java.lang.Object o)
          Returns the last index at which the object, o, occurs in the array.
 java.lang.Object set(int index, java.lang.Object element)
          Replaces the object at the specified index with the supplied element.
 int size()
          Returns the size of the array.
 java.lang.Object[] toArray()
          Transforms the list into an array of objects, by simplying cloning the array wrapped by this list.
 java.lang.Object[] toArray(java.lang.Object[] array)
          Copies the objects from this list into the supplied array.
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, iterator, listIterator, listIterator, remove, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, equals, hashCode, isEmpty, remove, removeAll, removeAllInternal, retainAll, retainAllInternal, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, containsAll, isEmpty, remove, removeAll, retainAll
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Compatible with JDK 1.4.

See Also:
Constant Field Values

a

private final java.lang.Object[] a
The array we are viewing.

Constructor Detail

Arrays.ArrayList

Arrays.ArrayList(java.lang.Object[] a)
Construct a list view of the array.

Method Detail

get

public java.lang.Object get(int index)
Returns the object at the specified index in the array.

Specified by:
get in interface List
Specified by:
get in class AbstractList

size

public int size()
Returns the size of the array.

Specified by:
size in interface List
Specified by:
size in class AbstractCollection

set

public java.lang.Object set(int index,
                            java.lang.Object element)
Replaces the object at the specified index with the supplied element.

Specified by:
set in interface List
Overrides:
set in class AbstractList

contains

public boolean contains(java.lang.Object o)
Returns true if the array contains the supplied object.

Specified by:
contains in interface List
Overrides:
contains in class AbstractCollection

indexOf

public int indexOf(java.lang.Object o)
Returns the first index at which the object, o, occurs in the array.

Specified by:
indexOf in interface List
Overrides:
indexOf in class AbstractList

lastIndexOf

public int lastIndexOf(java.lang.Object o)
Returns the last index at which the object, o, occurs in the array.

Specified by:
lastIndexOf in interface List
Overrides:
lastIndexOf in class AbstractList

toArray

public java.lang.Object[] toArray()
Transforms the list into an array of objects, by simplying cloning the array wrapped by this list.

Specified by:
toArray in interface List
Overrides:
toArray in class AbstractCollection

toArray

public java.lang.Object[] toArray(java.lang.Object[] array)
Copies the objects from this list into the supplied array. The supplied array is shrunk or enlarged to the size of the internal array, and filled with its objects.

Specified by:
toArray in interface List
Overrides:
toArray in class AbstractCollection