Package ch.hslu.exercises.sw02.ex3
Interface Stack<T>
- All Known Implementing Classes:
ArrayStringStack
public interface Stack<T>
-
Method Summary
Modifier and TypeMethodDescriptionboolean
isEmpty()
Checks if the stack is empty.boolean
isFull()
Checks if the Stack is full.peek()
Take a look the top element without removing it.pop()
Take the top element from the stack.void
Pushes an element on top of the stack.int
size()
Get the size of the Stack.
-
Method Details
-
size
int size()Get the size of the Stack.- Returns:
- the size of the Stack
-
peek
T peek()Take a look the top element without removing it.- Returns:
- the top element of the Stack
-
pop
T pop()Take the top element from the stack.- Returns:
- the top element of the stack
-
push
Pushes an element on top of the stack.- Parameters:
element
- to be pushed to the stack
-
isEmpty
boolean isEmpty()Checks if the stack is empty.- Returns:
- true if empty and false if not
-
isFull
boolean isFull()Checks if the Stack is full.- Returns:
- True if no element can be added anymore.
-