public class ArrayList extends Object implements List, Serializable
ArrayList
,
Serialized FormModifier and Type | Field and Description |
---|---|
private Vector |
hiddenList |
private List |
realHiddenList |
private static long |
serialVersionUID |
Constructor and Description |
---|
ArrayList()
Default Constructor, creates an empty List
|
ArrayList(ArrayList toBeHiddenList)
Constructs an ArrayList from a java.util.ArrayList.
|
ArrayList(int size)
Constructor specifying list size
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Object o)
Inserts the specified element at the specified position in this list
|
boolean |
add(Object o)
Adds an element.
|
void |
clear()
Removes all of the elements from this list (optional operation).
|
Object |
clone()
Method declaration
|
boolean |
contains(Object o)
Returns true if this list contains the specified element.
|
void |
fromList(List l)
Fill this list with the content of a given
java.util.List object. |
Object |
get(int index)
Returns the element at the specified position in this list.
|
private List |
getData() |
int |
indexOf(Object o)
Returns the index in this list of the first occurrence of the specified
element, or -1 if this list does not contain this element.
|
boolean |
isEmpty()
Checks if the collection contains elements.
|
Iterator |
iterator()
Returns an iterator over the elements in this collection.
|
private void |
readObject(ObjectInputStream in)
A customized readObject() method is needed to ensure compatibility with
the J2ME version of this class in serialization/deserialization
operations
|
Object |
remove(int index)
Removes the element at the specified position in this list.
|
boolean |
remove(Object o)
Removes one instance of the specified element.
|
private void |
setData(List data) |
int |
size()
Returns the number of elements in this collection.
|
Object[] |
toArray()
Returns an array containing all of the elements in this collection.
|
List |
toList()
Method declaration
|
String |
toString() |
private void |
writeObject(ObjectOutputStream out)
A customized writeObject() method is needed to ensure
compatibility with the J2ME version of this class in
serialization/deserialization operations.
|
private transient List realHiddenList
private Vector hiddenList
private static final long serialVersionUID
public ArrayList()
public ArrayList(int size)
public ArrayList(ArrayList toBeHiddenList)
public void clear()
List
public boolean contains(Object o)
List
public Object get(int index)
List
public int indexOf(Object o)
List
public Object remove(int index)
List
public void add(int index, Object o)
public boolean add(Object o)
Collection
add
in interface Collection
interface
public boolean isEmpty()
Collection
isEmpty
in interface Collection
interface
public boolean remove(Object o)
Collection
remove
in interface Collection
o
- the element to be removedinterface
public Iterator iterator()
Collection
iterator
in interface Collection
interface
public Object[] toArray()
Collection
toArray
in interface Collection
interface
public int size()
Collection
size
in interface Collection
interface
public Object clone()
public List toList()
public void fromList(List l)
java.util.List
object.l
- The java.util.List
to copy the content
from.private void writeObject(ObjectOutputStream out) throws IOException
IOException
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
private void setData(List data)
private List getData()