code: public static Comparator<Row> compareByKey() {
      return new Comparator<Row>() {
        @Override
        public int compare(Row r1, Row r2) {
          return ByteStringComparator.INSTANCE.compare(r1.getKey(), r2.getKey());
        }
      };
    }
docs: Returns a comparator that compares two Row objects by comparing the result of {@link
  #getKey()}} for each.