remove from double linked list
<p>I am to java and I am trying to implement a remove from double linked list method but I am struggling and not sure how to advance. The method removes data stored at the given node in the list.  I have read that I need to account for cases where the the element being removed is the start or end but I am not sure how to go about. In general I am not sure if this is the right way to do it.  My code/progress is posted below. If any could help, it would be appreciated. Thanks</p>

<p>P.S. I have a start and an end reference within the class and a size reference </p>

<pre><code> public type removeAtTheIndex(int index) 
  {
     type theData = null;
    Node &lt;type&gt; current= start;
    Node temp= new Node();
    if (index &gt;= 0 &amp;&amp; index &lt; size &amp;&amp; start !=null)
    {

        for (int i=0; i &lt; index &amp;&amp; current.getNext()!= null; i++)
        {
            current=current.getNext();
        }
        if (current != null)
        {
        if (current == start)
        {

        }

        else if (current == end)
        {

         }

        else
        {
            theData= current.getData();
            temp= current.getPrev();
            temp.setNext(current.getNext());
            current.getNext().setPrev(temp);
            current.setData(null);
            size--;

        }

    }

    return theData;
}
</code></pre>
