public int getSize() {
        int counter = 0;
        Occurrence temp = head;
        while (head != null) {
            counter++;
            head = head.next;
        }
        head = temp;
        return counter;
    }