I need help making the int size(); method for a Circularly linked list in Java. This is what I have tried. Is it true?
<pre><code>public int size(){
    node n = head;
    node m = tail;
    int size = 0;
    While(n!=m){
        size++;
        n=n.getNext();
        }
    return size;
    }
</code></pre>

<p>Is this code correct? I'm not so sure and I'm asking for you guys opinion</p>