java.util
Class Arrays.ArrayList

java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.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.
| 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 |
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.
Arrays.ArrayList
Arrays.ArrayList(java.lang.Object[] a)
- Construct a list view of the array.
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