|
7 | 7 | * Interface to provide queue specific functionality to the implementing class
|
8 | 8 | * This interface only defines the functionality which the queue implementing classes require.
|
9 | 9 | * Any class having queue behaviour should implement this interface and override all of its methods
|
| 10 | + * |
10 | 11 | * @param <T>
|
11 | 12 | */
|
12 | 13 | publicinterfaceQueue<T>extendsDataStructure<T> {
|
13 | 14 |
|
14 |
| -//Method to add element |
15 |
| -publicbooleanoffer(Tt)throwsNullPointerException; |
16 |
| - |
17 |
| -//Method to remove element |
18 |
| -publicTpoll(); |
19 |
| - |
20 |
| -//Method to check element on head |
21 |
| -publicTpeek(); |
22 |
| - |
23 |
| -//Method to check element on head. This throws exception on runtime if the queue is empty |
24 |
| -publicTelement()throwsNoSuchElementException; |
25 |
| - |
26 |
| - |
| 15 | +/** |
| 16 | + * Method to add element |
| 17 | + * |
| 18 | + * @param t element |
| 19 | + * @return boolean |
| 20 | + * @throws NullPointerException |
| 21 | + */ |
| 22 | +booleanoffer(Tt)throwsNullPointerException; |
| 23 | + |
| 24 | +/** |
| 25 | + * Method to remove element |
| 26 | + * |
| 27 | + * @return element |
| 28 | + */ |
| 29 | +Tpoll(); |
| 30 | + |
| 31 | +/** |
| 32 | + * Method to check element on head |
| 33 | + * |
| 34 | + * @return element |
| 35 | + */ |
| 36 | +Tpeek(); |
| 37 | + |
| 38 | +/** |
| 39 | + * Method to check element on head. This throws exception on runtime if the queue is empty |
| 40 | + * |
| 41 | + * @return element |
| 42 | + * @throws NoSuchElementException |
| 43 | + */ |
| 44 | +Telement()throwsNoSuchElementException; |
27 | 45 | }
|