title: deleting from doubly linked list - java
body: <p>I'm trying to better undserstand my teachers notes on how to delete a node from a doubly linked list, what she had on the boards is</p>
  
  <pre><code> public void deleteNode(Node D){
   Node current = head;
   while(current.data != D.data &amp;&amp; current.next != null){
    current = current.next;
     }
    d.prev.next = d.next;
    d.next.prev = current.prev.
   }
  </code></pre>
  
  <p>I can't help but feel like this isn't enough to remove a node.  I was thinking maybe she meant </p>
  
  <pre><code>current.prev.next = d.next and
  current.next.prev = d.prev
  </code></pre>
  
  <p>Once I figure out how to understand this better would it make sense if I wanted to delete a node from the middle by doing</p>
  
  <pre><code>public void deleteMiddle(){
      Node current = head;
      int i = 0;
      while(i &lt; size/2){
          current = current.next;
          i++;
      }
      deleteNode(current);
  }
  </code></pre>