E
- the element type.public class ArrayList<E> extends AbstractList<E> implements List<E>, Cloneable, RandomAccess, Serializable
This implementation differs from JDK 1.5 ArrayList
in terms of
capacity management. There is no speed advantage to pre-allocating array
sizes in JavaScript, so this implementation does not include any of the
capacity and "growth increment" concepts in the standard ArrayList class.
Although ArrayList(int)
accepts a value for the initial
capacity of the array, this constructor simply delegates to
ArrayList()
. It is only present for compatibility with JDK
1.5's API.
modCount
Constructor and Description |
---|
ArrayList() |
ArrayList(Collection<? extends E> c) |
ArrayList(int initialCapacity) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E o) |
void |
add(int index,
E o) |
boolean |
addAll(Collection<? extends E> c) |
boolean |
addAll(int index,
Collection<? extends E> c) |
void |
clear() |
Object |
clone() |
boolean |
contains(Object o) |
void |
ensureCapacity(int capacity) |
E |
get(int index) |
int |
indexOf(Object o) |
boolean |
isEmpty() |
int |
lastIndexOf(Object o) |
E |
remove(int index) |
boolean |
remove(Object o) |
protected void |
removeRange(int fromIndex,
int endIndex) |
E |
set(int index,
E o) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] out) |
void |
trimToSize() |
checkIndex, equals, hashCode, indexOutOfBounds, iterator, listIterator, listIterator, subList
containsAll, removeAll, retainAll, toString
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
public ArrayList()
public ArrayList(Collection<? extends E> c)
public ArrayList(int initialCapacity)
public boolean add(E o)
add
in interface Collection<E>
add
in interface List<E>
add
in class AbstractList<E>
public void add(int index, E o)
public boolean addAll(Collection<? extends E> c)
addAll
in interface Collection<E>
addAll
in interface List<E>
addAll
in class AbstractCollection<E>
public boolean addAll(int index, Collection<? extends E> c)
public void clear()
clear
in interface Collection<E>
clear
in interface List<E>
clear
in class AbstractList<E>
public Object clone()
public boolean contains(Object o)
contains
in interface Collection<E>
contains
in interface List<E>
contains
in class AbstractCollection<E>
public void ensureCapacity(int capacity)
public E get(int index)
public int indexOf(Object o)
public boolean isEmpty()
isEmpty
in interface Collection<E>
isEmpty
in interface List<E>
isEmpty
in class AbstractCollection<E>
public int lastIndexOf(Object o)
lastIndexOf
in interface List<E>
lastIndexOf
in class AbstractList<E>
public E remove(int index)
public boolean remove(Object o)
remove
in interface Collection<E>
remove
in interface List<E>
remove
in class AbstractCollection<E>
public int size()
size
in interface Collection<E>
size
in interface List<E>
size
in class AbstractCollection<E>
public Object[] toArray()
toArray
in interface Collection<E>
toArray
in interface List<E>
toArray
in class AbstractCollection<E>
public <T> T[] toArray(T[] out)
toArray
in interface Collection<E>
toArray
in interface List<E>
toArray
in class AbstractCollection<E>
public void trimToSize()
protected void removeRange(int fromIndex, int endIndex)
removeRange
in class AbstractList<E>
Copyright © 2018. All rights reserved.