这个问题在这里已经有了答案:Generictypeinferencenotworkingwithmethodchaining?(2个答案)关闭6年前。我需要对点列表进行排序。首先我需要比较x值,然后如果x值相等,则比较y值。所以我想我会使用thenComparing方法:Comparatorcmp=Comparator.comparingInt(p->p.x).thenComparingInt(p->p.y);但我不断收到消息:不兼容的类型:Comparator无法转换为Comparator。我可以通过其他方式进行这种比较,并且它有效,但我不明白我在这里做错了什么。