All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface jdsl.simple.api.Stack

public interface Stack
Interface for a stack.

A stack is a collection of objects elements that are inserted and removed according to the last-in first-out principle.

See Also:
StackEmptyException, Queue, Deque

Method Index

 o isEmpty()
Tests if the stack is empty
 o pop()
Remove the top element.
 o push(Object)
Insert an element at the top.
 o size()
Return the number of elements.
 o top()
Inspect the top element, without removing it or otherwise modifying the stack.

Methods

 o size
 public abstract int size()
Return the number of elements.

Returns:
number of elements in the stack.
 o isEmpty
 public abstract boolean isEmpty()
Tests if the stack is empty

Returns:
true if the stack is empty, false otherwise.
 o top
 public abstract Object top() throws StackEmptyException
Inspect the top element, without removing it or otherwise modifying the stack.

Returns:
top element in the stack.
Throws: StackEmptyException
If this stack is empty.
 o push
 public abstract void push(Object element)
Insert an element at the top.

Parameters:
element - new element to be inserted.
 o pop
 public abstract Object pop() throws StackEmptyException
Remove the top element.

Returns:
element removed.
Throws: StackEmptyException
if this stack is empty

All Packages  Class Hierarchy  This Package  Previous  Next  Index