public static void main(String[] args) {标签:分割,String,Arrays,list,firstRow,collect,add,数组,字符串 From: https://www.cnblogs.com/carlors/p/17647749.html
List<String> list = new ArrayList<>();
list.add("2.0;2.2;4.0");
list.add("3.0;4.2;5.0");
list.add("4.0;5.2;3.0");
String[] firstRow = list.get(0).split(";");
List<String> collect = Arrays.stream(firstRow)
.map(i -> Arrays.stream(list.toArray(new String[0]))
.mapToDouble(row -> Double.parseDouble(row.split(";")[Arrays.asList(firstRow).indexOf(i)]))
.average()
.orElse(0.0))
.map(i -> String.format("%.1f", i))
.collect(Collectors.toList());
System.out.println(String.join(";", collect));
}