org.apache.commons.collections
クラス ArrayStack

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.ArrayList
                    |
                    +--org.apache.commons.collections.ArrayStack
すべての実装インタフェース:
java.lang.Cloneable, java.util.Collection, java.util.List, java.io.Serializable

public class ArrayStack
extends java.util.ArrayList

An implementation of the Stack API that is based on an ArrayList instead of a Vector, so it is not synchronized to protect against multi-threaded access. The implementation is therefore operates faster in environments where you do not need to worry about multiple thread contention.

バージョン:
$Revision: 1.3 $ $Date: 2001/05/04 16:33:18 $
作成者:
Craig R. McClanahan
関連項目:
Stack, 直列化された形式

コンストラクタの概要
ArrayStack()
           
 
メソッドの概要
 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 search(java.lang.Object o)
          Return the one-based position of the distance from the top that the specified object exists on this stack, where the top-most element is considered to be at distance 1.
 
クラス java.util.ArrayList から継承したメソッド
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, set, size, toArray, toArray, trimToSize
 
クラス java.util.AbstractList から継承したメソッド
equals, hashCode, iterator, listIterator, listIterator, subList
 
クラス java.util.AbstractCollection から継承したメソッド
containsAll, remove, removeAll, retainAll, toString
 
クラス java.lang.Object から継承したメソッド
getClass, notify, notifyAll, wait, wait, wait
 
インタフェース java.util.List から継承したメソッド
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList
 

コンストラクタの詳細

ArrayStack

public ArrayStack()
メソッドの詳細

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.
例外:
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.
パラメータ:
n - Number of items down to go
例外:
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.
例外:
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.
パラメータ:
item - Item to be added

search

public int search(java.lang.Object o)
Return the one-based position of the distance from the top that the specified object exists on this stack, where the top-most element is considered to be at distance 1. If the object is not present on the stack, return -1 instead. The equals() method is used to compare to the items in this stack.
パラメータ:
o - Object to be searched for


Copyright © 2001 Apache Software Foundation. Documenation generated November 5 2001.