public static <A extends Comparable<? super A>, B> Comparator<Pair<A, B>> comparingByFirst() {
    return new Comparator<Pair<A, B>>() {
      @Override
      public int compare(Pair<A, B> o1, Pair<A, B> o2) {
        return o1.first.compareTo(o2.first);
      }
    };
  }
public static <A extends Comparable<? super A>, B> Comparator<Pair<A, B>> comparingByFirst()