String转Double
单个转换
double indexValue = Double.parseDouble(indexString)
String批量转换Double
List<String> stringList = new ArrayList<>();
stringList.add("123.30");
stringList.add("123.31");
stringList.add("123.32");
stringList.add("123.33");
stringList.add("123.34");
List<Double> doubleList = stringList.stream().map(i -> Double.parseDouble(i)).collect(Collectors.toList());
对象中的属性转换
自己实际应用案例
double componentTotalWeight = componentMapper.selectList(componentQuery).stream().map(i -> Double.parseDouble(i.getTotalWeightCustomer())).reduce(Double::sum).get();