I have a the following lambda expression. My IDE (Intellij idea) tells me it should be replaced with Comparator.comparingDouble
but I cannot find a way to do it.
List<javafx.stage.Screen> screenList = screens;
screenList.sort((screenA, screenB) -> Double.compare(
screenA.getBounds().getMinX(), screenB.getBounds().getMinX()));
Is there a way to accomplish this with
screenList.sort(Comparator.comparingDouble(...));
or is this a false annotation from Intellij? Thank you in advance for your help!
You just need a function that converts Screen
to double
:
screenList.sort(Comparator.comparingDouble(screen -> screen.getBounds().getMinX()));