小编Jos*_*vas的帖子

如何从数组对象列表中找到max元素?

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中.

java arrays arraylist

5
推荐指数
1
解决办法
5783
查看次数

标签 统计

arraylist ×1

arrays ×1

java ×1