-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStack.java
More file actions
48 lines (41 loc) · 1.1 KB
/
Copy pathStack.java
File metadata and controls
48 lines (41 loc) · 1.1 KB
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
44
45
46
47
48
interface Stack<T> {
/*
* Purpose: Insert an item onto the top of the stack
* Parameters: (int) - the item to insert
* Returns: Nothing
* Throws: FullStackException if array is full
*/
public void push(T v);
/*
* Purpose: Removes and returns the top item from the stack
* Parameters: None
* Returns: (int) - the data value of the element removed
* Throws: EmptyStackException if array is empty
*/
public T pop();
/*
* Purpose: Determines whether the stack is empty
* Parameters: None
* Returns: (boolean) - true if the stack is empty, false otherwise
*/
public boolean isEmpty();
/*
* Purpose: Determines whether the stack is full
* Parameters: None
* Returns: (boolean) - true if the stack is full, false otherwise
*/
public boolean isFull();
/*
* Purpose: Accesses the top item on the stack
* Parameters: None
* Returns: (int) - the data value of the top element
* Throws: EmptyStackException if array is empty
*/
public T top();
/*
* Purpose: Removes all elements from the stack
* Parameters: None
* Returns: Nothing
*/
public void popAll();
}