Just playing with the new lambda and functional features in Java 8 and I'm not sure how to do this.
For example the following is valid:
Map<String, Integer> map = new HashMap<>();
map.put("A", 1);
map.put("B", 2);
map.put("C", 3);
map.compute("A", (k, v) -> v == null ? 42 : v + 41));
but the following gives me syntax errors:
BiFunction x = (k, v) -> v == null ? 42 : v + 41;
map.compute("A", x);
Any ideas?