Class IntStack


  • public class IntStack
    extends Object
    A stack of integer primitives. This should be more efficient than a java.util.Stack
    • Constructor Detail

      • IntStack

        public IntStack()
    • Method Detail

      • push

        public void push​(int i)
      • peek

        public int peek()
        Returns:
        the int at the top of the stack
      • pop

        public int pop()
        pop the stack
        Returns:
        the int at the top of the stack
      • isEmpty

        public boolean isEmpty()
        Returns:
        true iff the stack is empty
      • size

        public int size()
        Returns:
        the number of elements in the stack.
      • get

        public int get​(int i)
        Returns:
        the ith int from the bottom of the stack