-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQueueADT.java
47 lines (39 loc) · 1.09 KB
/
QueueADT.java
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
import java.util.NoSuchElementException;
/**
* An parameterized interface for the Queue Abstract Data Type
*
* @author Benjamin Kuperman (Spring 2005, Spring 2012, Spring 2014)
*/
public interface QueueADT<T> {
/**
* Add an item to the queue
* @param item the data item to add (of type T)
*/
void enqueue(T item);
/**
* Remove the front item from the queue
* @return the front item in the queue
* @throws NoSuchElementException if the queue is empty
*/
T dequeue() throws NoSuchElementException;
/**
* Return the front item in the queue without removing it
* @return the front item in the queue
* @throws NoSuchElementException if the queue is empty
*/
T front() throws NoSuchElementException;
/**
* Find how many items are in the queue
* @return the number of items in the queue
*/
int size();
/**
* Determine if the queue is empty
* @return true if the size is 0, false otherwise
*/
boolean isEmpty();
/**
* Clear out the data structure
*/
void clear();
}