Using Collection.size() to test for emptiness works, but using Collection.isEmpty() makes the code more readable.

The following code:

if (myCollection.size() == 0) {  // Non-Compliant
  /* ... */
}

should be refactored into:

if (myCollection.isEmpty()) {    // Compliant
  /* ... */
}