All Packages  Class Hierarchy  This Package  Previous  Next  Index  
Class structure.StackList
java.lang.Object
    |
    +----structure.StackList
- public class StackList
- extends Object- implements Stack
An implementation of a stack, based on lists.  The head of the
stack is stored at the head of the list.
 
 StackList() StackList()
- Construct an empty stack.
 
 add(Object) add(Object)
- Add a value to the top of the stack.
 clear() clear()
- Remove all elements from the stack.
 empty() empty()
- Determine if the stack is empty.
 isEmpty() isEmpty()
- Determine if the stack is empty.
 peek() peek()
- Get a reference to the top value in the stack.
 pop() pop()
- Remove a value from the top of the stack.
 push(Object) push(Object)
- Value is added to the top of the stack.
 remove() remove()
- Remove a value from the top of the stack.
 size() size()
- Determine the number of elements in the stack.
 toString() toString()
- Construct a string representation of the stack.
 
 StackList
StackList
public StackList()
- Construct an empty stack.
 
- Postcondition:
-  constructs a new stack, based on lists
 
 
 
 clear
clear
public void clear()
- Remove all elements from the stack.
 
- Postcondition:
-  removes all elements from stack
 
 
 empty
empty
public boolean empty()
- Determine if the stack is empty.
Provided for compatibility with java.util.Stack.empty.
 
- Postcondition:
-  returns true iff the stack is empty
 
 
- 
- Returns:
- True iff the stack is empty.
- See Also:
- isEmpty
 
 isEmpty
isEmpty
public boolean isEmpty()
- Determine if the stack is empty.
 
- Postcondition:
-  returns true iff the stack is empty
 
 
- 
- Returns:
- True iff the stack is empty.
- See Also:
- empty
 
 peek
peek
public Object peek()
- Get a reference to the top value in the stack.
 
- Precondition:
-  stack is not empty
- Postcondition:
-  returns the top element (most recently pushed) from stack
 
 
- 
- Returns:
- A reference to the top element of the top of the stack.
 
 add
add
public void add(Object value)
- Add a value to the top of the stack.
 
- Postcondition:
-  adds an element to stack.
Will be next element popped if no intervening push
 
 
- 
- Parameters:
- item - The value to be added.
- See Also:
- push
 
 push
push
public void push(Object value)
- Value is added to the top of the stack.
 
- Postcondition:
-  adds an element to stack.
will be next element popped if no intervening push
 
 
- 
- Parameters:
- item - The value to be added.
 
 remove
remove
public Object remove()
- Remove a value from the top of the stack.
 
- Precondition:
-  stack is not empty
- Postcondition:
-  removes and returns the top element from stack.
 
 
- 
- Returns:
- The value removed from the top of the stack.
- See Also:
- pop
 
 pop
pop
public Object pop()
- Remove a value from the top of the stack.
 
- Precondition:
-  stack is not empty
- Postcondition:
-  removes and returns the top element from stack.
 
 
- 
- Returns:
- The value removed.
 
 size
size
public int size()
- Determine the number of elements in the stack.
 
- Postcondition:
-  returns the size of the stack
 
 
- 
- Returns:
- The number of values within the stack.
 
 toString
toString
public String toString()
- Construct a string representation of the stack.
 
- Postcondition:
-  returns a string representation of stack
 
 
- 
- Returns:
- A string representing the stack.
- Overrides:
- toString in class Object
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index