I want to sort a list with Lambda:
List messagesByDeviceType = new ArrayList(); messagesByDeviceType.sort((Message o1, Messag
The compare() method must return an int, and it seems yours is returning a long.
compare()
int
long
You can change it this into:
Long.compare(o1.getTime(),o2.getTime())
Well explained regarding lambda comparator in the below presented video link.