Collections.max(arraylist)不起作用,常规for循环也不起作用.
我有的是:
ArrayList<Forecast> forecasts = current.getForecasts();
Run Code Online (Sandbox Code Playgroud)
Collections.max(forecast) 给我这个错误:
The method max(Collection<? extends T>) in the type Collections is
not applicable for the arguments (ArrayList<Forecast>)
Run Code Online (Sandbox Code Playgroud)
在ArrayList保持Forecast每个具有对象int字段的每一天的温度.我试图将max存储在int max中.