-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStack.java
More file actions
43 lines (34 loc) · 874 Bytes
/
Stack.java
File metadata and controls
43 lines (34 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/** The abstract data type <code>Stack</code>.
*
* @author Marcel Turcotte (turcotte@eecs.uottawa.ca)
*/
public interface Stack<E> {
/** Returns <code>true</code> if this stack is empty, and
* <code>false</code> otherwise.
*
* @return <code>true</code> if this stack is empty, and
* <code>false</code> otherwise.
*/
boolean isEmpty();
/** Returns the top element, without removing it.
*
* @return the top element
*/
E peek();
/** Removes and returns the top element.
*
* @return the top element
*/
E pop();
/** Inserts an element onto the stack.
*
* @param element the element to be inserted
*/
void push( E element);
/** Rolls the stack
*/
void roll();
/** Unrolls the stack.
*/
void unroll();
}