Class IntStack


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

      Constructors 
      Constructor Description
      IntStack()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int get​(int i)  
      boolean isEmpty()  
      int peek()  
      int pop()
      pop the stack
      void push​(int i)  
      int size()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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