title: java doubly linked list delete a node
body: <p>I was given an integer called key as the parameter. I need to know how to delete a node at position key. Ndata is from my Node class. </p>
  
  <pre><code>    public void deleteNode(int key)
      {
         Node&lt;E&gt; temp = head; 
         while(temp.Ndata != key)//gives me error as not compatible types.    
         {
              temp = temp.next;
         }
         if(temp == head)
              head = temp.next;
         else
              temp.prev.next = temp.next;
         if(temp == tail)
              tail == temp.prev;
         else
              temp.prev.next = temp.next;
       }
  </code></pre>