We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 320b5de commit 5ce337fCopy full SHA for 5ce337f
src/main/java/com/types/Queue.java
@@ -1,6 +1,8 @@
1
package src.main.java.com.types;
2
3
4
+import java.util.NoSuchElementException;
5
+
6
/**
7
* Interface to provide queue specific functionality to the implementing class
8
* This interface only defines the functionality which the queue implementing classes require.
@@ -10,7 +12,7 @@
10
12
public interface Queue<T> extends DataStructure<T> {
11
13
14
//Method to add element
- public boolean offer(T t);
15
+ public boolean offer(T t) throws NullPointerException;
16
17
//Method to remove element
18
public T poll();
@@ -19,7 +21,7 @@ public interface Queue<T> extends DataStructure<T> {
19
21
public T peek();
20
22
23
//Method to check element on head. This throws exception on runtime if the queue is empty
- public T element();
24
+ public T element() throws NoSuchElementException;
25
26
27
}
0 commit comments