public static void checkNotEmpty(Collection collection){
  if (collection.isEmpty()) {
    throw new NullPointerException();
  }
}

public static void checkNotEmpty ( Collection collection ) { if ( collection . isEmpty ( ) ) { throw new NullPointerException ( ) ; } }
ensures that a collection reference passed as a parameter to the calling method is not empty .
