title: Computing the size of a linked list using recursion/helper function - Java
body: <p>Beginner here using Java (first year student), and am unable to get the below function to work.  The goal is to use recursion and a helper function to compute the size of a singly linked list.  When running the code against test lists, it keeps returning <code>List changed to []</code>. </p>
  
  <p>I'm struggling in general with Java, so any help is appreciated.  Thank you</p>
  
  <pre><code>public class MyLinked {
    static class Node {
     public Node(double item, Node next) {
      this.item = item;
      this.next = next;
     }
     public double item;
     public Node next;
    }
    int N;
    Node first;
  
    public int sizeForward() {
     return sizeForwardHelper(first);
    }
  
    public int sizeForwardHelper(Node n) {
     Node current = first;
     if (current == null) {
      return 0;
     } else {
      first = first.next;
      return sizeForward() + 1;
     }
    }
  </code></pre>
  
  <p>I believe I have the first portion set up to return 0 if there are no elements in the List.  I believe it's the second part that isn't setting up correctly?</p>
  
  <p>Thanks</p>