Collections.max(arraylist) doesn\'t work, and a regular for loop won\'t work either.
Collections.max(arraylist)
for
What I have is:
ArrayList
Another solution is use map reduce:
Optional element = forecasts .stream() .reduce((a,b) -> a.getTemperature() > b.getTemperature() ? a : b );
In this way you could even use use parallelStream()
parallelStream()