|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ArrayListStack<E>
public class ArrayListStack<E>
Implementation of a stack as an ArrayList
Constructor Summary | |
---|---|
ArrayListStack()
No argument constructor |
Method Summary | |
---|---|
boolean |
isEmpty()
Method to check if the stack is empty |
static void |
main(String[] args)
|
E |
peek()
Method to return the top element on the stack but not remove it. |
E |
pop()
Method to remove and return the top element on the stack |
void |
push(E element)
Method to add an element to the top of the stack |
int |
size()
Method to return the number of elements in the stack |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArrayListStack()
Method Detail |
---|
public void push(E element)
push
in interface Stack<E>
element
- the element to addpublic E peek()
peek
in interface Stack<E>
public E pop()
pop
in interface Stack<E>
public int size()
size
in interface Stack<E>
public boolean isEmpty()
isEmpty
in interface Stack<E>
public static void main(String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |