list literal gotcha and suggestion
Paul Benedict
pbenedict at apache.org
Mon Sep 28 19:54:22 PDT 2009
Josh,
I thought the proposal used brackets or braces depending on what was the
left-hand side of the assignment. If I have my facts straight, I would like
to see a proposal where that's not the case and only one is actually used.
List<String> stringList = { "1", "2", "3" };
Set<String> stringSet = { "1", "2", "3" };
Map<String, String> stringMap = { "1" : "A", "2" : "B", "3" : "C" };
I don't think it matters if { } or [ ] is used, but not both.
Paul
On Mon, Sep 28, 2009 at 7:48 PM, Joshua Bloch wrote:
> Paul,
> I'm not sure what you mean. If you mean type parameter, no. But if you
> mean List vs. Set vs. Map, yes, the compiler needs a different syntax to
> tell them apart.
>
> Josh
>
>
> On Mon, Sep 28, 2009 at 1:53 PM, Paul Benedict wrote:
>
>> Joshua,
>>
>> What will the official proposal be? If a different syntax is required to
>> initialize based on the type, it's too much thought for something so
>> trivial.
>>
>> Paul
>>
>>
>
More information about the coin-dev
mailing list