| java.util.Stack
Stack | public class Stack extends Vector (Code) | | Stack is a Last-In/First-Out(LIFO) data structure which
represents a stack of objects. It enables users to pop and push onto the
stack, including null objects. There is no limit to the size of the stack
|
Constructor Summary | |
public | Stack() Constructs a stack with the default size of Vector . |
Method Summary | |
public boolean | empty() Determines if the stack is empty or not. | public synchronized E | peek() Returns the element at the top of the stack without removing it. | public synchronized E | pop() Returns the element at the top of the stack and removes it. | public E | push(E object) Pushes the object from the parameter onto the top of the stack. | public synchronized int | search(Object object) Returns the index of the first occurrence of the object. |
Stack | public Stack()(Code) | | Constructs a stack with the default size of Vector .
|
empty | public boolean empty()(Code) | | Determines if the stack is empty or not.
true if the stack is empty, false otherwise |
peek | public synchronized E peek()(Code) | | Returns the element at the top of the stack without removing it.
the element at the top of the Stack exception: EmptyStackException - when empty() is true See Also: Stack.pop |
pop | public synchronized E pop()(Code) | | Returns the element at the top of the stack and removes it.
the element at the top of the stack. exception: EmptyStackException - when empty() is true See Also: Stack.peek See Also: Stack.push |
push | public E push(E object)(Code) | | Pushes the object from the parameter onto the top of the stack.
Parameters: object - The object to be added to the stack the object argument See Also: Stack.peek See Also: Stack.pop |
search | public synchronized int search(Object object)(Code) | | Returns the index of the first occurrence of the object.
the index of the first occurrence of the object Parameters: object - the object to be searched |
|
|