Skip to content

Commit 5ce337f

Browse files
author
asri71
committed
Code changes to adhere to code best practices
1 parent 320b5de commit 5ce337f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package src.main.java.com.types;
22

33

4+
import java.util.NoSuchElementException;
5+
46
/**
57
* Interface to provide queue specific functionality to the implementing class
68
* This interface only defines the functionality which the queue implementing classes require.
@@ -10,7 +12,7 @@
1012
public interface Queue<T> extends DataStructure<T> {
1113

1214
//Method to add element
13-
public boolean offer(T t);
15+
public boolean offer(T t) throws NullPointerException;
1416

1517
//Method to remove element
1618
public T poll();
@@ -19,7 +21,7 @@ public interface Queue<T> extends DataStructure<T> {
1921
public T peek();
2022

2123
//Method to check element on head. This throws exception on runtime if the queue is empty
22-
public T element();
24+
public T element() throws NoSuchElementException;
2325

2426

2527
}

0 commit comments

Comments
 (0)