|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectist.palcom.base.Object
ist.palcom.base.ArrayList
public class ArrayList
ArrayList is an array based list that supports most of the interface of Java ArrayList. The storage is automatically extended to make room for new elements. Adding elements to the front or back takes time amortized O(1).
| Constructor Summary | |
|---|---|
ArrayList()
Creates a new ArrayList. |
|
ArrayList(int n)
Creates a new ArrayList. |
|
| Method Summary | |
|---|---|
void |
add(Object value)
Adds the specified value after the last element of this ArrayList. |
void |
addFirst(Object value)
Adds the specified value before the first element of this ArrayList. |
void |
addLast(Object value)
Adds the specified value after the last element of this ArrayList. |
Array |
asArray()
Returns an array containing all elements in this ArrayList in the correct order. |
Object |
at(int index)
Returns the element at the specified position. |
void |
at(int index,
Object value)
Replaces the element at the specified position with the specified value. |
void |
clear()
Removes all elements from this ArrayList giving an empty list. |
boolean |
contains(Object value)
Tests if this ArrayList contains the specified value. |
int |
indexOf(Object value)
Returns the index of the first occurrence of the specified value in this ArrayList. |
void |
init()
Initializes this ArrayList. |
boolean |
isEmpty()
Tests if this ArrayList is empty. |
int |
lastIndexOf(Object value)
Returns the index of the last occurrence of the specified value in this ArrayList. |
void |
remove(Object value)
Removes on instance of the specified value from this ArrayList. |
void |
removeAt(index index)
Removes the element at the specified position while sliding all elements to the right of the position leftward. |
Object |
removeFirst()
Removes the first element of this ArrayList. |
Object |
removeLast()
Removes the last element of this ArrayList. |
int |
size()
Returns the number of elements in this ArrayList. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ArrayList(int n)
n - int initial capacitypublic ArrayList()
| Method Detail |
|---|
public Array asArray()
public int lastIndexOf(Object value)
value - Object the value to search for.
public void addLast(Object value)
value - Object the value to add after last element.public Object at(int index)
index - int index of element to return.
public int size()
public int indexOf(Object value)
value - Object the value to search for.
public void addFirst(Object value)
value - Object the value to add before the first element..public void remove(Object value)
value - Object value to remove.public Object removeLast()
public Object removeFirst()
public void removeAt(index index)
index - index of the element to remove.public void clear()
public void add(Object value)
value - Object the value to add after last element.public boolean contains(Object value)
value - Object value to search for.
public void at(int index,
Object value)
index - int index of element to replacevalue - Object new value to store at specified positionpublic void init()
public boolean isEmpty()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||