|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<E>
org.jawk.util.ArrayStackImpl<E>
public class ArrayStackImpl<E>
A stack implemented with an ArrayList. Unlike the java.util.Stack which uses a java.util.Vector as a storage mechanism, this implementation is non-synchronized to improve performance.
It performs quicker than the LinkedListStackImpl version.
There is no maximum capacity which is enforced, nor is there any checks if pop() is executed on an empty stack.
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
ArrayStackImpl()
Allocates an ArrayList with a capacity of 100. |
Method Summary | |
---|---|
E |
peek()
Inspect the top-most element without affecting the stack. |
E |
pop()
Pops an item off the stack. |
void |
push(E o)
Push an item to the stack. |
Methods inherited from class java.util.ArrayList |
---|
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeRange, retainAll, set, size, subList, toArray, toArray, trimToSize |
Methods inherited from class java.util.AbstractList |
---|
equals, hashCode |
Methods inherited from class java.util.AbstractCollection |
---|
containsAll, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.jawk.util.MyStack |
---|
clear, size |
Methods inherited from interface java.util.List |
---|
containsAll, equals, hashCode |
Constructor Detail |
---|
public ArrayStackImpl()
Method Detail |
---|
public void push(E o)
push
in interface MyStack<E>
o
- The item to push onto the stack.public E pop()
Warning: no checks are done in terms of size, etc. If a pop() occurrs on an empty stack, an ArrayIndexOutOfBoundException is thrown.
pop
in interface MyStack<E>
public E peek()
MyStack
peek
in interface MyStack<E>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |