Class Stack<T>

  • Type Parameters:
    T - type of elements in the stack.
    All Implemented Interfaces:
    Iterable<T>


    public class Stack<T>
    extends Object
    implements Iterable<T>
    A simple stack implementation based on ArrayList.
    • Constructor Detail

      • Stack

        public Stack()
    • Method Detail

      • push

        public void push(T element)
      • peek

        public T peek()
      • pop

        public T pop()
      • clear

        public void clear()
      • isEmpty

        public boolean isEmpty()
      • size

        public int size()
      • asList

        public List<T> asList()
        Returns an immutable list containing the elements in this stack.