title: Doubly linked list removing first element
body: <p>I'm pretty new to java, and my doubly linked list addFront method and addRear method works fine, but only dequeue method doesn't works. In the main method, I making a test to remove front element using <code>dequeueFront ()</code>method, when I  remove front element it works, but If I continued  removing front element, </p>
  
  <pre><code>Exception in thread "main" java.lang.NullPointerException
      at DoublyLinkedDeque.dequeueFront(DoublyLinkedDeque.java:97)
  </code></pre>
  
  <p>comes out,</p>
  
  <p>Line97 is the <code>frontNode.previous=null</code></p>
  
  <p>I just wondering how to remove front element form the double linked list properly.</p>
  
  <pre><code>public E dequeueFront() throws NoSuchElementException 
  {
      if(frontNode!=null)
      {
          E frontElement=frontNode.element;
          frontNode=frontNode.next;
          frontNode.previous=null;
          frontNode.next=null;
          numElement--;
          if(numElement==0)
              rearNode=null;
          return frontElement;
      }
      else
          throw new NoSuchElementException();
  }
  </code></pre>