|
BRUtil - Making Java a Kinder, Gentler, Place to be. |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--brutil.ArrayList
This is circular buffer implementation of a list with a standard java array as the underlying data structure. All operations to the ends of the ArrayList take constant time, while any modification operations to the middle of the ArrayList (using ListIterator or ReverseListIterator) take linear time.
| Constructor Summary | |
ArrayList(int maxSize)
An ArrayList of size maxSize |
|
| Method Summary | |
void |
append(java.lang.Object elt)
Appends the given element to the end of the list. |
void |
clean()
Use this method when you want to fully clear the underlying array and free up all objects for collection. |
void |
clear()
This clear method simply removes the pointer to the first item and resets the size Functionally, this clears the list, but the objects in the list are not freed for collection. |
java.lang.Object |
getFirst()
Returns the first element of the list |
java.lang.Object |
getLast()
Returns the element at the end of the list. |
void |
initMemory()
|
boolean |
isEmpty()
Returns true if there are no elements in the list (size == 0). |
ListIterator |
iterator()
Returns a ListIterator pointing to the head of the list. |
static void |
main(java.lang.String[] args)
|
int |
maxLength()
|
void |
prepend(java.lang.Object elt)
Prepends the given element to the beginning of the list. |
void |
printArray()
|
java.lang.Object |
removeFirst()
Removes the first element of the list. |
java.lang.Object |
removeLast()
Removes the last element of the list. |
ReverseListIterator |
reverseIterator()
Returns a ReverseListIterator pointing to the end of the list. |
int |
size()
Returns the number of elements in the list. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ArrayList(int maxSize)
maxSize| Method Detail |
public void initMemory()
public void append(java.lang.Object elt)
append in interface Listelt - The element that is to be appended.IllegalStateException - if the list has reached
maximum length.public void prepend(java.lang.Object elt)
prepend in interface Listelt - The element to be prepended.IllegalStateException - if the list has reached
maximum length.public java.lang.Object getFirst()
getFirst in interface ListNoSuchElementException - if the list is empty.public java.lang.Object getLast()
getLast in interface ListNoSuchElementException - if the list is empty.public java.lang.Object removeFirst()
removeFirst in interface ListNoSuchElementException - if the list is empty.public java.lang.Object removeLast()
removeLast in interface ListNoSuchElementException - if the list is empty.public void clear()
clear in interface Listpublic void clean()
public boolean isEmpty()
isEmpty in interface Listpublic int size()
size in interface Listpublic ListIterator iterator()
ListIterator pointing to the head of the list.iterator in interface Listpublic ReverseListIterator reverseIterator()
ReverseListIterator pointing to the end of the list.reverseIterator in interface Listbrutil.ListUnsupportedMethodException - public void printArray()
public static void main(java.lang.String[] args)
public int maxLength()
|
BRUtil - Making Java a Kinder, Gentler, Place to be. |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||