How to iterate nested for loops referring to parent elements using Java 8 streams?
问题 I want to iterate nested lists using java8 streams , and extract some results of the lists on first match. Unfortunately I have to also get a values from the parent content if a child element matches the filter. How could I do this? java7 Result result = new Result(); //find first match and pupulate the result object. for (FirstNode first : response.getFirstNodes()) { for (SndNode snd : first.getSndNodes()) { if (snd.isValid()) { result.setKey(first.getKey()); result.setContent(snd.getContent