private void checkPriority(double priority){
  if (Double.isNaN(priority))   throw new IllegalArgumentException(priority + " is invalid.");
}

private void checkPriority ( double priority ) { if ( Double . isNaN ( priority ) ) throw new IllegalArgumentException ( priority + " is invalid." ) ; }
utility function which , given a user - specified priority , checks whether it ' s a valid double and throws an illegalargumentexception otherwise .
