|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Stack
An interface describing a Last-In, First-Out structure. Stacks are typically used to store the state of a recursively solved problem.
Method Summary | |
---|---|
void |
add(java.lang.Object item)
Add an element from the top of the stack. |
boolean |
empty()
Returns true iff the stack is empty. |
java.lang.Object |
get()
Fetch a reference to the top element of the stack. |
java.lang.Object |
getFirst()
Fetch a reference to the top element of the stack. |
java.lang.Object |
peek()
Fetch a reference to the top element of the stack. |
java.lang.Object |
pop()
Remove an element from the top of the stack. |
void |
push(java.lang.Object item)
Add an element to top of stack. |
java.lang.Object |
remove()
Remove an element from the top of the stack. |
int |
size()
Returns the number of elements in the stack. |
Methods inherited from interface structure.Structure |
---|
clear, contains, elements, isEmpty, iterator, remove, values |
Method Detail |
---|
void add(java.lang.Object item)
add
in interface Linear
add
in interface Structure
item
- The element to be added to the stack top.push(java.lang.Object)
void push(java.lang.Object item)
item
- The value to be added to the top of the stack.java.lang.Object remove()
remove
in interface Linear
pop()
java.lang.Object pop()
java.lang.Object get()
get
in interface Linear
java.lang.Object getFirst()
java.lang.Object peek()
boolean empty()
empty
in interface Linear
int size()
size
in interface Linear
size
in interface Structure
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |