Skip to content

Commit 481be62

Browse files
authored
Update Queue.java
1 parent 965c288 commit 481be62

File tree

1 file changed

+31
-13
lines changed

1 file changed

+31
-13
lines changed

src/main/java/com/types/Queue.java

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,39 @@
77
* Interface to provide queue specific functionality to the implementing class
88
* This interface only defines the functionality which the queue implementing classes require.
99
* Any class having queue behaviour should implement this interface and override all of its methods
10+
*
1011
* @param <T>
1112
*/
1213
public interface Queue<T> extends DataStructure<T> {
1314

14-
//Method to add element
15-
public boolean offer(T t) throws NullPointerException;
16-
17-
//Method to remove element
18-
public T poll();
19-
20-
//Method to check element on head
21-
public T peek();
22-
23-
//Method to check element on head. This throws exception on runtime if the queue is empty
24-
public T element() throws NoSuchElementException;
25-
26-
15+
/**
16+
* Method to add element
17+
*
18+
* @param t element
19+
* @return boolean
20+
* @throws NullPointerException
21+
*/
22+
boolean offer(T t) throws NullPointerException;
23+
24+
/**
25+
* Method to remove element
26+
*
27+
* @return element
28+
*/
29+
T poll();
30+
31+
/**
32+
* Method to check element on head
33+
*
34+
* @return element
35+
*/
36+
T peek();
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+
T element() throws NoSuchElementException;
2745
}

0 commit comments

Comments
 (0)