Package dsa

Interface Stack<Item>

    • Method Detail

      • isEmpty

        boolean isEmpty()
        Returns true if this stack is empty, and false otherwise.
        Returns:
        true if this stack is empty, and false otherwise.
      • size

        int size()
        Returns the number of items in this stack.
        Returns:
        number of items in this stack.
      • push

        void push​(Item item)
        Adds item to the top of this stack.
        Parameters:
        item - the item.
      • peek

        Item peek()
        Returns the item at the top of this stack.
        Returns:
        item at the top of this stack.
      • pop

        Item pop()
        Removes and returns the item at the top of this stack.
        Returns:
        item at the top of this stack.