int total = list.stream().mapToInt(User::getAge).sum();
stream 计算一个List对象中某个字段总和
最新推荐文章于 2024-09-04 03:26:40 发布
int total = list.stream().mapToInt(User::getAge).sum();