Let\'s say I have a Pair class
public class Pair { public P p; public Q q; public Pair(P p, Q q) { this.p = p; this
{ public P p; public Q q; public Pair(P p, Q q) { this.p = p; this
It should be:
pairList.sort(Comparator.comparing(Pair::firstValue) .thenComparing(Pair::secondValue));
First type parameter refers to the type being passed to Comparator. Second type parameter refers to the type that comparator should effectively compare with.