Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1.  
  2. /**
  3. * Simple Stack interface.
  4. * @author bdb52
  5. * @version 1.0
  6. */
  7. public interface Stack<T> {
  8.  
  9. /**
  10. * Adds something to the top of the stack.
  11. * @param obj - the object to be added.
  12. * @return the object parameter.
  13. */
  14. public T push(T obj);
  15.  
  16. /**
  17. * Returns a reference to the top of the stack.
  18. * Does not modify the stack.
  19. * @return a reference to the top of the stack.
  20. */
  21. public T peek();
  22.  
  23. /**
  24. * Removes the top element from the stack.
  25. * @return a reference to the element that was on the top of the stack.
  26. */
  27. public T pop();
  28.  
  29. /**
  30. * Determines if the stack is empty.
  31. * @return true if the stack is empty.
  32. */
  33. public boolean empty();
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement