Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts.util
Class ArrayStack

    java.lang.Object
      |
      +--org.apache.struts.util.ArrayStack

All Implemented Interfaces:
  java.io.Serializable

public class ArrayStack
extends java.lang.Object
implements java.io.Serializable

Implementation of the `java.util.Stack` API that is based on an `ArrayList` rather than a `Vector`. This means no synchronization locks are utilized internally, so you must synchronize externally if an instance is referenced from multiple threads.

Version:
  $Revision: 1.1 $ $Date: 2001/09/17 20:13:30 $
Author:
  Craig R. McClanahan
See Also:
  Serialized Form

Field Summary
`protected java.util.ArrayList` | `list` The underlying collection class.

Constructor Summary
`ArrayStack()`

Method Summary
`void` | `clear()` Remove all elements from this stack.
`boolean` | `empty()` Return `true` if this stack is currently empty.
`java.lang.Object` | `peek()` Return the top item off of this stack without removing it.
`java.lang.Object` | `peek(int n)` Return the n'th item down (zero-relative) from the top of this stack without removing it.
`java.lang.Object` | `pop()` Pop the top item off of this stack and return it.
`java.lang.Object` | `push(java.lang.Object item)` Push a new item onto the top of this stack.
`int` | `size()` Return the number of items on this stack.

Methods inherited from class java.lang.Object
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait`

Field Detail

### list

    protected java.util.ArrayList list

  The underlying collection class.

Constructor Detail

### ArrayStack

    public ArrayStack()

Method Detail

### clear

    public void clear()

  Remove all elements from this stack. After this call, the stack will be empty.

### empty

    public boolean empty()

  Return `true` if this stack is currently empty.

### peek

    public java.lang.Object peek()
                          throws java.util.EmptyStackException

  Return the top item off of this stack without removing it.
  Throws:
    `EmptyStackExceptino` - if the stack is empty

### peek

    public java.lang.Object peek(int n)
                          throws java.util.EmptyStackException

  Return the n'th item down (zero-relative) from the top of this stack without removing it.
  Parameters:
    `n` - Number of items down to go
  Throws:
    `java.util.EmptyStackException` - if there are not enough items on the stack to satisfy this request

### pop

    public java.lang.Object pop()
                         throws java.util.EmptyStackException

  Pop the top item off of this stack and return it.
  Throws:
    `java.util.EmptyStackException` - if the stack is empty

### push

    public java.lang.Object push(java.lang.Object item)

  Push a new item onto the top of this stack. The pushed item is also returned.
  Parameters:
    `item` - Item to be added

### size

    public int size()

  Return the number of items on this stack.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2001 - Apache Software Foundation