-
Notifications
You must be signed in to change notification settings - Fork 0
/
QueueInterface.java
30 lines (25 loc) · 995 Bytes
/
QueueInterface.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
public interface QueueInterface {
/** Determines whether a queue is empty.
@returns true if the queue is empty; otherwise returns false.
*/
public boolean isEmpty();
/** Adds an item at the back of a queue.
@param newItem is the item to be inserted.
@throwsQueueException if newItem cannot be added to the queue.
*/
public void enqueue(Object newItem) throws QueueException;
/** Retrieves and removes the front of a queue.
@return the item that was added to the queue earliest
is returned
@throws QueueException if the operation is impossible
*/
public Object dequeue() throws QueueException;
/** Removes all items of a queue.
*/
public void dequeueAll();
/** Retrieves the item at the front of a queue.
@return item at front of queue (do not remove)
@throws QueueException if the operation is impossible
*/
public Object peek() throws QueueException;
} // end QueueInterface