Can someone help me get a better understanding of StackInterface in java?
I also am having trouble with some of these methods i need to write.
public interface StackInterface<T> {
/**
* Add element to top of stack.
* @param newEntry item to add to stack.
*/
public void push(T newEntry);
/**
* Remove and return top element from stack.
* @return top element.
* @throws EmptyStackException if the stack is empty
*/
public T pop();
/**
* Return top element from stack without modifying stack.
* @return Element on top of stack.
* @throws EmptyStackException if the stack is empty
*/
public T peek();
/**
* Whether stack is empty.
* @return True if stack is empty, false otherwise.
*/
public boolean isEmpty();
/**
* Remove all elements from stack.
*/
public void clear();
}

Can someone help me get a better understanding of StackInterface in ja.docx

  • 1.
    Can someone helpme get a better understanding of StackInterface in java? I also am having trouble with some of these methods i need to write. public interface StackInterface<T> { /** * Add element to top of stack. * @param newEntry item to add to stack. */ public void push(T newEntry); /** * Remove and return top element from stack. * @return top element. * @throws EmptyStackException if the stack is empty */ public T pop(); /** * Return top element from stack without modifying stack. * @return Element on top of stack. * @throws EmptyStackException if the stack is empty */ public T peek(); /** * Whether stack is empty. * @return True if stack is empty, false otherwise.
  • 2.
    */ public boolean isEmpty(); /** *Remove all elements from stack. */ public void clear(); }