你好,我非常新于Java编程,并且正尝试通过实现双向链表格式来创建一个Deque
类。当我运行代码(DequeApp)时,我得到了一个NullPointerException
,它指向我的Iterator.next(Deque.java:44)。
Error messages: **Exception in thread "main" java.lang.NullPointerException
at dlist.Deque$DoubleListIterator.next(Deque.java:44)
public E next() {
if (!hasNext()) {throw new NoSuchElementException();}
else{
E temp = current.item;
current = current.next;
return temp;}
}