fixed some formatting typos
[vimdoclet.git] / sample / java.util.Stack.txt
bloba53bf2f6838af681e2967e6edf0b47f23bb37f96
1 *java.util.Stack* *Stack* The Stack class represents a last-in-first-out
2  (LIFO)
4 public class Stack<E>
5   extends    |java.util.Vector|
7 |java.util.Stack_Description|
8 |java.util.Stack_Fields|
9 |java.util.Stack_Constructors|
10 |java.util.Stack_Methods|
12 ================================================================================
14 *java.util.Stack_Constructors*
15 |java.util.Stack()|Creates an empty Stack.
17 *java.util.Stack_Methods*
18 |java.util.Stack.empty()|Tests if this stack is empty.
19 |java.util.Stack.peek()|Looks at the object at the top of this stack without re
20 |java.util.Stack.pop()|Removes the object at the top of this stack and returns 
21 |java.util.Stack.push(E)|Pushes an item onto the top of this stack.
22 |java.util.Stack.search(Object)|Returns the 1-based position where an object is
24 *java.util.Stack_Description*
26 The Stack class represents a last-in-first-out (LIFO) stack of objects. It 
27 extends class Vector with five operations that allow a vector to be treated as 
28 a stack. The usual push and pop operations are provided, as well as a method to 
29 peek at the top item on the stack, a method to test for whether the stack is 
30 empty, and a method to search the stack for an item and discover how far it is 
31 from the top. 
33 When a stack is first created, it contains no items. 
35 A more complete and consistent set of LIFO stack operations is provided by the 
36 (|java.util.Deque|) interface and its implementations, which should be used in 
37 preference to this class. For example: 
39 Deque stack = new ArrayDeque(); 
43 *java.util.Stack()*
45 public Stack()
47 Creates an empty Stack. 
50 *java.util.Stack.empty()*
52 public boolean empty()
54 Tests if this stack is empty. 
58     Returns: true if and only if this stack contains no items; false otherwise. 
60 *java.util.Stack.peek()*
62 public synchronized |E| peek()
64 Looks at the object at the top of this stack without removing it from the 
65 stack. 
69     Returns: the object at the top of this stack (the last item of the Vector object). 
71 *java.util.Stack.pop()*
73 public synchronized |E| pop()
75 Removes the object at the top of this stack and returns that object as the 
76 value of this function. 
80     Returns: The object at the top of this stack (the last item of the Vector object). 
82 *java.util.Stack.push(E)*
84 public |E| push(E item)
86 Pushes an item onto the top of this stack. This has exactly the same effect as: 
88 addElement(item) 
91     item - the item to be pushed onto this stack. 
93     Returns: the item argument. 
95 *java.util.Stack.search(Object)*
97 public synchronized int search(java.lang.Object o)
99 Returns the 1-based position where an object is on this stack. If the object o 
100 occurs as an item in this stack, this method returns the distance from the top 
101 of the stack of the occurrence nearest the top of the stack; the topmost item 
102 on the stack is considered to be at distance 1. The equals method is used to 
103 compare o to the items in this stack. 
106     o - the desired object. 
108     Returns: the 1-based position from the top of the stack where the object is located; the 
109              return value -1 indicates that the object is not on the stack.