public static < T1 extends Comparable < T1 > , T2 extends Comparable < T2 > > Comparator < Pair < T1 , T2 > > naturalOrder ( ) { return new Comparator < Pair < T1 , T2 > > ( ) { @ Override public int compare ( Pair < T1 , T2 > lhs , Pair < T1 , T2 > rhs ) { return compareTo ( lhs , rhs ) ; } } ; }
creates a natural order for pairs of comparable things