title: LinkedList remove at index java
body: <p>I've made a remove method from scratch that removes a Node from a linked list at a specified index.</p>
  
  <p>It's not removing the correct Node. I've tried to step through with the debugger in eclipse but couldn't catch the problem.</p>
  
  <p>Each Node contains a token.
  I have included the Token class, Node class.
  I have written my methods in the List class and included a Test class.</p>
  
  <p>The remove method is currently removing the node next to the specified index.
  How can I get this to work? My apologies for the long post.</p>
  
  <pre><code>public class thelist{
  
      public Node head;
  
      public List() {
          head = null;
      }
  
      public Node remove(int index) {
          Node node= head;
          for (int i = 0; i &lt; index; i++) {
              node= node.next;
          }
          node.next = node.next.next;
          return node;
      }
  </code></pre>