Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 754
نمايش فراداده

Stack<E>java.util

Java 1.0cloneable serializable collection

This class implements a last-in-first-out (LIFO) stack of objects. push( ) puts an object on the top of the stack. pop( ) removes and returns the top object from the stack. peek( ) returns the top object without removing it. In Java 1.2, you can instead use a LinkedList as a stack.

Figure 16-58. java.util.Stack<E>

public class

Stack<E> extends Vector<E> { // Public Constructors public

Stack ( ); // Public Instance Methods public boolean

empty ( ); public E

peek ( ); synchronized public E

pop ( ); synchronized public E

push (E

item ); public int

search (Object

o ); synchronized }