Module openj9.dtfj

Class IntegerStack


  • public final class IntegerStack
    extends Object
    This class implements a simple stack of integers.
    • Constructor Detail

      • IntegerStack

        public IntegerStack​(int size)
        Create a new stack with the given size. It will grow as necessary.
    • Method Detail

      • push

        public void push​(int n)
        Push an integer on the stack.
      • pop

        public int pop()
        Pop an integer off the stack.
      • peek

        public int peek()
        Return the integer at the top of the stack without popping it.
      • depth

        public int depth()
        Return the depth of the stack.