【发布时间】:2019-04-11 08:56:23
【问题描述】:
我有一个 SeniorEmployee 类,它有一些属性,在同一类下我有 JuniorEmployee 列表。现在我的标准是通过流并基于一些标准在 SeniorEmployee 中迭代,然后对于与过滤条件匹配的 SeniorEmployee,我们需要在 JuniorEmployee 列表中迭代并计算他们的总薪水。那么,如何通过流在单个 lambda 表达式中做到这一点?请帮忙。
SeniorEmployee id 过滤条件是如果 EmpCode 为 10;
SeniorEmployee{
empCode;
List<JuniorEmployee> junEmpList
}
JuniorEmployee{
Emp Id;
Salary;
}
【问题讨论】:
标签: java java-8 java-stream