Java – compilation error when reverse order [duplicate]
This question already has answers here: Comparator.reversed() does not compile using lambda (5 answers) Closed last month. why the second sort occurs compilation error? List<List<Long>> list = Lists.newArrayList(); list.stream().sorted(Comparator.comparing(x -> x.get(0))); //works fine list.stream().sorted(Comparator.comparing(x -> x.get(0)).reversed()); //cannot work list.stream().sorted(Collections.reverseOrder(Comparator.comparing(x -> x.get(0)))); //works fine too I read the IDE prompt but I cannot understand. Can somebody […]