This is like using an Object[], but with names and no second level of boxing…

> On Nov 16, 2017, at 4:10 AM, John Rose <john.r.r...@oracle.com> wrote:
> 
> On Nov 15, 2017, at 5:15 PM, Remi Forax <fo...@univ-mlv.fr 
> <mailto: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!!!

Reply via email to