org.apache.tools.ant.util

Class IdentityStack


public class IdentityStack
extends Stack

Identity Stack.
Since:
Ant 1.7

Constructor Summary

IdentityStack()
Default constructor.
IdentityStack(Object o)
Construct a new IdentityStack with the specified Object as the bottom element.

Method Summary

boolean
contains(Object o)
Override methods that use .equals() comparisons on elements.
static IdentityStack
getInstance(Stack s)
Get an IdentityStack containing the contents of the specified Stack.
int
indexOf(Object o, int pos)
Override methods that use .equals() comparisons on elements.
int
lastIndexOf(Object o, int pos)
Override methods that use .equals() comparisons on elements.

Constructor Details

IdentityStack

public IdentityStack()
Default constructor.

IdentityStack

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

Method Details

contains

public boolean contains(Object o)
Override methods that use .equals() comparisons on elements.
Parameters:
o - the Object to search for.
Returns:
true if the stack contains the object.
See Also:
java.util.Vector.contains(Object)

getInstance

public static IdentityStack getInstance(Stack s)
Get an IdentityStack containing the contents of the specified Stack.
Parameters:
s - the Stack to copy; ignored if null.
Returns:
an IdentityStack instance.

indexOf

public int indexOf(Object o,
                   int pos)
Override methods that use .equals() comparisons on elements.
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:
java.util.Vector.indexOf(Object, int)

lastIndexOf

public int lastIndexOf(Object o,
                       int pos)
Override methods that use .equals() comparisons on elements.
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:
java.util.Vector.indexOf(Object, int)