CT Textbook Site
  

Sample Java API Documentation

The Stack Class

Stack API
boolean empty()
Tests if this stack is empty. Returns true if the stack is empty, and returns false if the stack contains elements.
Object peek( )
Returns the element on the top of the stack, but does not remove it.
Object pop( )
Returns the element on the top of the stack, removing it in the process.
Object push(Object element)
Pushes element onto the stack. element is also returned.
int search(Object element)
Searches for element in the stack. If found, its offset from the top of the stack is returned. Otherwise, .1 is returned.