📜  列表之和 java 代码示例

📅  最后修改于: 2022-03-11 14:52:02.758000             🧑  作者: Mango

代码示例4
//If you have a List
int sum = list.stream().mapToInt(Integer::intValue).sum();

//If it's an int[]
int sum = IntStream.of(a).sum();