Useful information:
IDE: IntelliJ JDK: 8u271
I have a warning which I do not understand nor do I know how to solve it. Warning:
Comparator does not return 0 for equal elements
The warning highlights
(a, b)
within this line of code.
private final Comparator<Entity> renderSorter = (a, b) -> {
if (a.getY() + a.getHeight() < b.getY() + b.getHeight())
return -1;
return 1;
};
What is the meaning of the warning and how do I solve it?