title: Measure size/length of singly linked list in Java?
body: <p>I need help making the <code>int size();</code> method for a singly linked list in Java.</p>
  
  <p>This is what I have so far, but it does not return the correct size of the list.</p>
  
  <pre><code>public int size()
  {
      int size = 0;
      Node CurrNode = head;
      while(CurrNode.next != null)
      {
          CurrNode = CurrNode.next;
          size++;     
      }
      return size;
  }
  </code></pre>
  
  <p>Can someone help me implement this method in Java?</p>