|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.jts.pi.ArrayListStack
public class ArrayListStack
The ArrayListStack class represents a last-in-first-out
(LIFO) stack of objects. It encapsulates class ArrayList with four
operations that allow a list to be treated as a stack. The usual
push and pop operations are provided, as well as a
method to peek at the top item on the stack, and a method to test
for whether the stack is empty
When a stack is first created, it contains no items.
| Constructor Summary | |
|---|---|
ArrayListStack()
Creates a stack with a default size |
|
ArrayListStack(int size)
Creates a stack with the given initial size |
|
| Method Summary | |
|---|---|
boolean |
empty()
Tests if this stack is empty. |
java.lang.Object |
peek()
Looks at the object at the top of this stack without removing it from the stack. |
java.lang.Object |
pop()
Removes the object at the top of this stack and returns that object as the value of this function. |
void |
push(java.lang.Object obj)
Pushes an item onto the top of this stack. |
int |
size()
Provides the current size of the stack. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ArrayListStack(int size)
public ArrayListStack()
| Method Detail |
|---|
public int size()
public void push(java.lang.Object obj)
obj - the object to be pushed onto this stack.ArrayList.add(E)public java.lang.Object pop()
public boolean empty()
true if and only if this stack contains
no items; false otherwise.public java.lang.Object peek()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||