edu.umd.cs.piccolo.util
Class PStack
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.ArrayList
edu.umd.cs.piccolo.util.PStack
- All Implemented Interfaces:
- Serializable, Cloneable, Iterable, Collection, List, RandomAccess
public class PStack
- extends ArrayList
PStack this class should be removed when a non thread safe stack is
added to the java class libraries.
- Version:
- 1.0
- Author:
- Jesse Grosjean
- See Also:
- Serialized Form
Constructor Summary |
PStack()
Creates an empty stack. |
Method Summary |
Object |
peek()
Returns topmost element on the stack, or null if stack is empty. |
Object |
pop()
Removes top element on the stack and returns it. |
void |
push(Object o)
Pushes the provided object onto the top of the stack. |
Methods inherited from class java.util.ArrayList |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize |
PStack
public PStack()
- Creates an empty stack.
push
public void push(Object o)
- Pushes the provided object onto the top of the stack.
- Parameters:
o
- object to add to the stack
peek
public Object peek()
- Returns topmost element on the stack, or null if stack is empty.
- Returns:
- topmost element on the stack, or null if empty
pop
public Object pop()
- Removes top element on the stack and returns it.
- Returns:
- topmost element on stack.
Copyright © 1995-2011 Piccolo2D. All Rights Reserved.