|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--BasicArrayList
BasicArrayList.java
Illustrates the implementation of several of the ArrayList methods.
Created: Wed Feb 19 11:24:05 2003
| Field Summary |
| Fields inherited from class java.util.AbstractList |
modCount |
| Constructor Summary | |
BasicArrayList()
Constructs an empty list with an initial capacity of ten. |
|
BasicArrayList(int initialCapacity)
Constructs an empty list with the specified initial capacity. |
|
| Method Summary | |
boolean |
add(Object o)
Appends the specified element to the end of this list. |
Object |
get(int index)
Returns the element at the specified position in this list. |
Object |
remove(int index)
Removes the element at the specified position in this list. |
int |
size()
Returns the number of elements in this list. |
String |
toString()
Returns a string representation of this list. |
| Methods inherited from class java.util.AbstractList |
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, set, subList |
| Methods inherited from class java.util.AbstractCollection |
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
| Constructor Detail |
public BasicArrayList(int initialCapacity)
throws IllegalArgumentException
initialCapacity - the initial capacity of the list.
IllegalArgumentException - if the specified initial capacity is negativepublic BasicArrayList()
| Method Detail |
public Object get(int index)
throws IndexOutOfBoundsException
get in interface Listget in class AbstractListindex - index of element to return.
IndexOutOfBoundsException - if index out of range
(index < 0 || index >= size()).public int size()
size in interface Listsize in class AbstractCollectionpublic boolean add(Object o)
add in interface Listadd in class AbstractListo - element to be appended to this list.
public Object remove(int index)
throws IndexOutOfBoundsException
remove in interface Listremove in class AbstractListindex - the index of the element to removed.
IndexOutOfBoundsException - if index out of range
(index < 0 || index >= size()).public String toString()
toString in class AbstractCollection
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||