I just need a java method that complies withe the JavaDocs above the method name
ID: 3596279 • Letter: I
Question
I just need a java method that complies withe the JavaDocs above the method name. Using a arraylist.
public class WorkAheadQueue<T> implements WorkAheadQueueADT<T> {
private LinearNode<T> front;
private LinearNode<T> back;
private int numNodes;
private ArrayList<LinearNode<T>> frontFive;
Explanation / Answer
Please find my implementation.
Please let me know in case of any issue.
public T first(int x) throws EmptyCollectionException, InvalidArgumentException {
if( x > 4 || x > numNodes) {
throw new InvalidArgumentException();
}
return frontFive.get(x);
}