org.apache.tools.ant.util
Class IdentityStack<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector<E>
              extended by java.util.Stack<E>
                  extended by org.apache.tools.ant.util.IdentityStack<E>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, java.util.RandomAccess

public class IdentityStack<E>
extends java.util.Stack<E>

Identity Stack.

Since:
Ant 1.7
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
IdentityStack()
          Default constructor.
IdentityStack(E o)
          Construct a new IdentityStack with the specified Object as the bottom element.
 
Method Summary
 boolean contains(java.lang.Object o)
          Override methods that use .equals() comparisons on elements.
static
<E> IdentityStack<E>
getInstance(java.util.Stack<E> s)
          Get an IdentityStack containing the contents of the specified Stack.
 int indexOf(java.lang.Object o, int pos)
          Override methods that use .equals() comparisons on elements.
 int lastIndexOf(java.lang.Object o, int pos)
          Override methods that use .equals() comparisons on elements.
 
Methods inherited from class java.util.Stack
empty, peek, pop, push, search
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IdentityStack

public IdentityStack()
Default constructor.


IdentityStack

public IdentityStack(E o)
Construct a new IdentityStack with the specified Object as the bottom element.

Parameters:
o - the bottom element.
Method Detail

getInstance

public static <E> IdentityStack<E> getInstance(java.util.Stack<E> s)
Get an IdentityStack containing the contents of the specified Stack.

Parameters:
s - the Stack to copy; ignored if null.
Returns:
an IdentityStack instance.

contains

public boolean contains(java.lang.Object o)
Override methods that use .equals() comparisons on elements.

Specified by:
contains in interface java.util.Collection<E>
Specified by:
contains in interface java.util.List<E>
Overrides:
contains in class java.util.Vector<E>
Parameters:
o - the Object to search for.
Returns:
true if the stack contains the object.
See Also:
Vector.contains(Object)

indexOf

public int indexOf(java.lang.Object o,
                   int pos)
Override methods that use .equals() comparisons on elements.

Overrides:
indexOf in class java.util.Vector<E>
Parameters:
o - the Object to search for.
pos - the position from which to search.
Returns:
the position of the object, -1 if not found.
See Also:
Vector.indexOf(Object, int)

lastIndexOf

public int lastIndexOf(java.lang.Object o,
                       int pos)
Override methods that use .equals() comparisons on elements.

Overrides:
lastIndexOf in class java.util.Vector<E>
Parameters:
o - the Object to search for.
pos - the position from which to search (backward).
Returns:
the position of the object, -1 if not found.
See Also:
Vector.indexOf(Object, int)