I need to sort a list of Points. First I need to compare the x value, then if the x values are equal, the y value. So I thought I'd use the thenComparing method:
Comparator<Point> cmp = Comparator.comparingInt(p -> p.x).thenComparingInt(p -> p.y);
But I keep getting the message: Incompatible types: Comparator<Object> cannot be converted to Comparator<Point>.
There are other ways I can make this comparison, and it works, but I don't understand what I'm doing wrong here.