Code changes to adhere to code best practices
This commit is contained in:
parent
320b5de0fe
commit
5ce337fa54
@ -1,6 +1,8 @@
|
||||
package src.main.java.com.types;
|
||||
|
||||
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/**
|
||||
* Interface to provide queue specific functionality to the implementing class
|
||||
* This interface only defines the functionality which the queue implementing classes require.
|
||||
@ -10,7 +12,7 @@ package src.main.java.com.types;
|
||||
public interface Queue<T> extends DataStructure<T> {
|
||||
|
||||
//Method to add element
|
||||
public boolean offer(T t);
|
||||
public boolean offer(T t) throws NullPointerException;
|
||||
|
||||
//Method to remove element
|
||||
public T poll();
|
||||
@ -19,7 +21,7 @@ public interface Queue<T> extends DataStructure<T> {
|
||||
public T peek();
|
||||
|
||||
//Method to check element on head. This throws exception on runtime if the queue is empty
|
||||
public T element();
|
||||
public T element() throws NoSuchElementException;
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user