Collections.max(arraylist) doesn't work, and a regular for loop won't work either.
What I have is:
ArrayList<Forecast> forecasts = current.getForecasts();
Collections.max(forecast) gives me this error:
The method max(Collection<? extends T>) in the type Collections is
not applicable for the arguments (ArrayList<Forecast>)
The ArrayList holds Forecast objects which each has an int field for the temperature of each day. I am trying to store the max in an int max.
forecastsArrayList of Forecast, is not an array of int. Both a loop andmax()work correctly when used appropriately.