T
- public class SimpleStack<T>
extends java.lang.Object
implements java.lang.Iterable<T>
A simple, non thread-safe stack, missing from java.util.
Constructor and Description |
---|
SimpleStack() |
public void push(T data)
public T peek()
public T peek(int depth)
Take a look at the element depth
levels deep beneath
the top element (which is at depth 0). This requires O(depth) steps.
depth
- public T pop()
public boolean isEmpty()
public int size()