java 8: anonymous class fields could be available later in next lambdas (IDEA-123731)

This commit is contained in:
Anna Kozlova
2014-04-09 19:27:16 +02:00
parent 258af30a8d
commit 6d7cfc99c2
3 changed files with 46 additions and 4 deletions
@@ -0,0 +1,21 @@
import java.util.Collection;
import java.util.Map;
class Test{
public static void main(String[] args) {
Map<String, Collection<Integer>> myMap = null;
myMap.entrySet().stream()
.flatMap(entry -> entry.getValue().stream()
.map(val -> new Object() {
String key = entry.getKey();
Integer va<caret>lue = val;
}))
.forEachOrdered(o -> {
final String key = o.key;
final Integer value = o.value;
System.out.println("key: " + key + " value: " + value);
});
}
}