JEP 186: Collection Literals

Remi Forax forax at univ-mlv.fr
Wed Jan 15 07:53:32 PST 2014


On 01/15/2014 04:15 PM, Olivier Allouch wrote:
> Hi,
>
> 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.

yes, right.

>
> 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.

or Iterable/the enhanced for.
One issue is that the shape of the interface Buildable is not obvious,
at some point during the development of the Stream API (and before it
was called the Stream API) we try to abstract a notion close to the
notion of Buildable before switching to use Collector because capturing
this concept with an interface is hard.

> 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 :-) ).

BGGA (Neal Gafter BTW), CICE and FCM specs were all important to explore 
the design space.
The lambda of Java 8 are built on the discoveries of these giants.

>
> I love the new Java pace !
>
> Olivier Allouch
> www.illicotravel.com

cheers,
Rémi

>
> Le 14/01/2014 01:17, mark.reinhold at oracle.com a écrit :
>> Posted: http://openjdk.java.net/jeps/186
>>
>> - Mark
>>
>



More information about the lambda-dev mailing list