Java / Ope / Collection操作 / Stream / 終端処理 / collect / averagingDouble

Java / Ope / Collection操作 / Stream / 終端処理 / collect / averagingDouble

平均値を取る。

List<Double> dList = new ArrayList<>();
dList.add(10.0);
dList.add(20.0);
dList.add(30.0);
 
//=> 20.0
System.out.println(dList.stream().collect(Collectors.averagingDouble(v -> v))); 
java/ope/collection_ope/stream/tarminator/collect/averagingdouble.txt · 最終更新: 2020-12-31 09:56 by ore