Methods Summary |
---|
public java.lang.Object | peek()Provides a look at the first object placed on the stack, since it
will be the first one out. This method does not change the contents
of the stack. Because this class is unsynchronized, applications
using this class are responsible for making sure that a
peek() followed by a pop() returns the
same value.
Object ob;
if( size() == 0 ) {
return null;
}
ob = get(0);
return ob;
|
public java.lang.Object | pop()Pops the first object placed on the stack off of it and returns it.
Object ob;
if( size() == 0 ) {
return null;
}
ob = get(0);
remove(0);
return ob;
|
public java.lang.Object | push(java.lang.Object ob)Pushes a new object onto the end of stack.
add(ob);
return ob;
|
public int | search(java.lang.Object ob)Searches the stack for the specified object. Returns the location
of the object with respect to the first object on the stack or -1.
int i = indexOf(ob);
if( i == -1 ) {
return -1;
}
else {
return (i+1);
}
|