Android
java.util
public class

java.util.Stack<E>

java.lang.Object
java.util.AbstractCollection<E> Collection<E>
java.util.AbstractList<E> List<E>
java.util.Vector<E> Serializable Cloneable List<E> RandomAccess
java.util.Stack<E>

Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables users to pop and push onto the stack, including null objects. There is no limit to the size of the stack

Summary

Fields inherited from class java.util.Vector
Fields inherited from class java.util.AbstractList

Public Constructors

            Stack()
Constructs a stack with the default size of Vector.

Public Methods

          boolean  empty()
Determines if the stack is empty or not.
  synchronized        peek()
Returns the element at the top of the stack without removing it.
  synchronized        pop()
Returns the element at the top of the stack and removes it.
  synchronized        push(E object)
Pushes the object from the parameter onto the top of the stack.
  synchronized        int  search(Object o)
Returns the index of the first occurrence of the object.
Methods inherited from class java.util.Vector
Methods inherited from class java.util.AbstractList
Methods inherited from class java.util.AbstractCollection
Methods inherited from class java.lang.Object
Methods inherited from interface java.lang.Iterable
Methods inherited from interface java.util.Collection
Methods inherited from interface java.util.List

Details

Public Constructors

public Stack()

Constructs a stack with the default size of Vector.

Public Methods

public boolean empty()

Determines if the stack is empty or not.

Returns

  • true if the stack is empty, false otherwise

public synchronized E peek()

Returns the element at the top of the stack without removing it.

Returns

  • the element at the top of the Stack

Throws

EmptyStackException when empty() is true

See Also

public synchronized E pop()

Returns the element at the top of the stack and removes it.

Returns

  • the element at the top of the stack.

Throws

EmptyStackException when empty() is true

See Also

public synchronized E push(E object)

Pushes the object from the parameter onto the top of the stack.

Parameters

object The object to be added to the stack

Returns

  • the object argument

See Also

public synchronized int search(Object o)

Returns the index of the first occurrence of the object.

Parameters

o the object to be searched

Returns

  • the index of the first occurrence of the object
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56