-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStackInterface.java
More file actions
37 lines (31 loc) · 908 Bytes
/
Copy pathStackInterface.java
File metadata and controls
37 lines (31 loc) · 908 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
package TreePackage;
import java.util.EmptyStackException;
public interface StackInterface<T>
{
/**
* Adds a new entry to the top of this stack
* @param anEntry The object to add to the stack
*/
void push(T anEntry);
/**
* Removes and returns this stack's top entry
* @return The object currently at the top of the stack
* @throws EmptyStackException if the stack is empty
*/
T pop();
/**
* Retrieves this stack's top entry but does NOT remove it
* @return The object currently at the top of the stack
* @throws EmptyStackException if the stack is empty
*/
T peek();
/**
* Detects whether this stack is empty
* @return true if the stack is empty, false otherwise
*/
boolean isEmpty();
/**
* Removes all entries from the stack
*/
void clear();
}