Implementing a remove method for a doubly linked list
<p>I'm trying to implement a doubly linked list for a class assignment.  I am currently stuck on implementing a method to remove a node at a specified index.  </p>

<pre><code>public void remove(int index) {
    if (index &lt; 0 || index &gt; count-1) {
        throw new ListIndexOutOfBoundsException("The index "+index+" is out of bounds.");
    }
    if (isEmpty()) {
        System.out.println("List is empty");
        return;
    }

    MedicationNode curr = head;
    int k = 0;
    while(k &lt; index) {
        curr = curr.next;
        k++;
    }
    if (curr.prev == null) {
        curr.next.prev = null;
    }else if(curr.next == null) {
        curr = curr.prev;
        curr.next = null;
    }else{
        curr.next.prev = curr.prev;
        curr.prev.next = curr.next;
    }           
    count--;
}
</code></pre>

<p>the method can remove any specified node in a linked list except index 0.  I'm thinking the problem may be with my add method but im not really sure. </p>