/** * An interface defineition for the Stack ADT * @author gtowell * Created: Feb 14, 2020 * Modified: Oct 6, 2020 * Modified: Aug 6, 2021 */ public interface StackIntf { /** * Tests if this stack is empty. * @return true if and only if this stack contains no items; false otherwise. */ public boolean isEmpty(); /** * Pushes an item onto the top of this stack. * @param e the element to be added to the stack or null if the items could not be added * @return the added element. */ public E push(E e); /** * Looks at the object at the top of this stack without removing it from the stack. * @return the item at the top of the stack or null if the stack is empty */ public E peek(); /** * Removes the object at the top of this stack * and returns that object as the value of this function. * @return The removed object or null if the stack is empty */ public E pop(); /** * Gives the number of items in the stack * @return The number of items in the stack. */ public int size(); /** * Remove all elements from the stack */ public void clear(); }