title: If a LinkedList is empty, return nothing from a method that returns an int?
body: <p>EDIT: Solved. Returning a 0 works, apparently!</p>
  
  <p>Ok so long story short, I have to return an int value, but nothing when a Linked List is empty. How do I do it?</p>
  
  <pre><code>public int countDuplicates() {
  
  int duplicates = 0;
  
  ListNode current = front;
  
  int num = current.data;
  current = current.next;
  
  while(current != null) {
      if(current.data == num) {
          duplicates++;
      } else {
          num = current.data;
      }
      current = current.next;
  }
  return duplicates;
  }
  </code></pre>
  
  <p>When I try this:</p>
  
  <pre><code>if(front == null) {
      return ;
  }
  </code></pre>
  
  <p>This doesn't work. What can I do?</p>