forked from rampatra/Algorithms-and-Data-Structures-in-Java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQueue.java
61 lines (46 loc) · 956 Bytes
/
Queue.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.rampatra.base;
/**
* A generic interface for a queue.
*
* @author rampatra
* @since 4/12/15
*/
public interface Queue<E> {
/**
* Inserts the specified element into this queue.
*
* @param item
* @return
*/
public E add(E item);
/**
* Retrieves and removes the head of this queue. This method throws an
* exception if this queue is empty.
*
* @return
*/
public E remove();
/**
* Retrieves, but does not remove, the head of this queue. This method throws an
* exception if this queue is empty.
*
* @return
*/
public E element();
/**
* Returns the size of this queue.
*
* @return
*/
public int size();
/**
* Tests whether the queue is empty or not.
*
* @return
*/
public boolean isEmpty();
/**
* Prints the content of the queue.
*/
public void print();
}