-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStackADT.java
More file actions
40 lines (35 loc) · 871 Bytes
/
StackADT.java
File metadata and controls
40 lines (35 loc) · 871 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
/**
* An interface that describes a stack abstract data type
*/
public interface StackADT
{
/**
* Add an item onto the stack
* @param item the data item to add (of type T)
*/
public void push(Square item);
/**
* Remove the top item from the stack
* @return the top item in the stack
*/
public Square pop();
/**
* Returns but does not remove the top item from the stack
* @return the top item in the stack
*/
public Square peek();
/**
* Return how many items are in the stack
* @return the number of items in the stack
*/
public int size();
/**
* Determine if the stack is empty
* @return true if the size is 0, false otherwise
*/
public boolean isEmpty();
/**
* Remove all elements from the data structure
*/
public void clear();
}