How to find size of a queue in LinkedQueue.java without a counter variable
<p>So for a project I have to create a LinkedQueue class but without a counter variable so I can't exactly keep track of how many elements are in the queue.
I need to create a size method to return the number of elements in the queue but I have no idea how to do it...here's my code:</p>

<pre><code>package animal;
import exceptions.EmptyQueueException;

/**
* @author Sharon Umute 
* Comp 139 001B
*/
public class LinkedQueue&lt;T&gt; implements QueueADT&lt;T&gt;{

SinglyLinkedNode&lt;T&gt; tail,head;

public LinkedQueue(){
    head=tail=null;
}

@Override
public void enqueue(T element) {
    SinglyLinkedNode&lt;T&gt; node =new SinglyLinkedNode&lt;T&gt;(element); 
    if(isEmpty()){
        head = node;
    }else{
        tail.setNext(node);
    }
    tail=node;
}

@Override
public T dequeue() throws EmptyQueueException {
    if (isEmpty()){
        throw new EmptyQueueException("queue");
    }else{
        T result = head.getElement();
        head=head.getNext();

        if(isEmpty()){
            tail=null;
        }
        return result;
    }
}

@Override
public T first() throws EmptyQueueException {
    if (isEmpty()){
        throw new EmptyQueueException("queue");
    }else{
        T result=head.getElement();
        return result;
    }
}

@Override
public boolean isEmpty() {
    return(head.getElement()==null);
}

@Override
public int size() {

}

}
</code></pre>