On Nov 15, 2017, at 5:15 PM, Remi Forax <fo...@univ-mlv.fr> wrote: > > List<String> list = List.of("hello", "world!"); > Map<Integer, String> map = list.stream() > .map(s -> new Object() { int key = s.length(); String value = s; }) > .collect(Collectors.toMap(t -> t.key, t -> t.value)); > System.out.println(map); > > so i guess 'leaking' the type of an anonymous class is not an issue.
That's cool; I didn't know Java had anonymous tuples!!!