📅  最后修改于: 2022-03-11 14:48:17.438000             🧑  作者: Mango
//If you have a List
int sum = list.stream().mapToInt(Integer::intValue).sum();
//If it's an int[]
int sum = IntStream.of(a).sum();