public static boolean different(GenericRecord first,GenericRecord second,List<String> valueFieldNames){
  for (  String valueFieldName : valueFieldNames) {
    Object firstValue=first.get(valueFieldName);
    Object secondValue=second.get(valueFieldName);
    if (firstValue != null && secondValue != null && !firstValue.equals(secondValue)) {
      return true;
    }
    if ((firstValue != null && secondValue == null) || (firstValue == null && secondValue != null)) {
      return true;
    }
  }
  return false;
}

public static boolean different ( GenericRecord first , GenericRecord second , List < String > valueFieldNames ) { for ( String valueFieldName : valueFieldNames ) { Object firstValue = first . get ( valueFieldName ) ; Object secondValue = second . get ( valueFieldName ) ; if ( firstValue != null && secondValue != null && ! firstValue . equals ( secondValue ) ) { return true ; } if ( ( firstValue != null && secondValue == null ) || ( firstValue == null && secondValue != null ) ) { return true ; } } return false ; }
whether the two records are considered different , based on the values of the fields that have been provided to check for differences .
