假设我有一个'A'列表
List<A> as;
Run Code Online (Sandbox Code Playgroud)
如果我想对每个A进行相当多的处理,并且在处理结束时,我想将结果放在A的另一个字段中,那么最好的方法是什么?
即
as.stream().
map(a -> a.getX()).
filter(x -> x != null).
map(x -> lookup.get(x)).
At this point how to say y -> a.setLookedUpVal(y)?
Run Code Online (Sandbox Code Playgroud)
我在lambda链中失去了对'a'的引用.有没有办法存储它并返回它或什么?