Package panda.utilities.collection
Interface IStack<T>
- All Known Implementing Classes:
FixedStack
public interface IStack<T>
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear the stackbooleanisEmpty()Tests if stack is emptypeek()Check element on top of the stackpop()Removes the object at the top of this stack and returns that object as the valuevoidPushes an item onto the top of this stackintsize()Returns the number of items in this stackT[]Converts stack into the array, ordered by the push order (the latest items are the first in array)
-
Method Details
-
push
Pushes an item onto the top of this stack- Parameters:
element- the item to be pushed onto this stack
-
peek
T peek()Check element on top of the stack- Returns:
- the value on top
-
pop
T pop()Removes the object at the top of this stack and returns that object as the value- Returns:
- the object at the top of this stack
-
clear
void clear()Clear the stack -
size
int size()Returns the number of items in this stack- Returns:
- the number of items
-
isEmpty
boolean isEmpty()Tests if stack is empty- Returns:
- true if and only if this stack contains no items
-
toArray
Converts stack into the array, ordered by the push order (the latest items are the first in array)- Returns:
- the array of items from stack
-