JEP 186: Collection Literals

Olivier Allouch oallouch at
Wed Jan 15 07:15:50 PST 2014


My personal remarks (no expert here):

1. Java is getting the good parts of JavaScript...and I like it !
When I code in JavaScript, I do a lot a functions like fn1(mainParam1, 
mainParam2, options), where options is an Object (a Map in our case). In 
this 'options' Object are all the optional (and named) parameters. Being 
able to do it simply Java is huge ! That leads me to my second point:

2. 90% of Map literal are going to be used with String keys.

3. I'm strongly in favor of (trying to) have a general Buildable 
interface, so that this construct can be applied to many classes. This 
is nothing new to Java enhancements. Seems to me it's in the same family 
as the Closable interface for the try operator. The notation (is it 
really important now?) could be MyClass#{"fooName": fooValue, "barName": 
barValue} , but there could be a smart default (like HashMap or 
Immutablexxx). If it goes too far, we still can go back and do a more 
Collection-specific version. It doesn't seem to crazy. (remember the 
beginning of lambdas with the Niel Gafter proposal :-) ).

I love the new Java pace !

Olivier Allouch

Le 14/01/2014 01:17, mark.reinhold at a écrit :
> Posted:
> - Mark

More information about the lambda-dev mailing list