list literal gotcha and suggestion

Kai Kunstmann Kai.Kunstmann at combase.de
Thu Oct 8 01:04:36 PDT 2009


Am Mittwoch, den 07.10.2009, 17:46 -0700 schrieb Lawrence Kesteloot:
> > http://www.google.com/codesearch?hl=en&lr=&q=ImmutableList.of|ImmutaleSet.of|ImmutableMap.of|Arrays.asList\(\w%2B,\w%2B+lang:java&sbtn=Search
> >
> > Seems like all sorts of configuration/static data/quick and
> > dirty/unittest/mock/etc types of syntax would benefit.
> 
> That search returns 800 files out of a total of 11,300,000. That's one
> file in 14,125, or 0.007%.
> 
> I would be against a feature which (1) has such an unclear correct
> specification; (2) provides so little advantage over a static
> ArrayList.of() and HashSet.of(); and (3) helps only one file in
> 14,125.
> 
> On the other hand, the idea (proposed twice in this discussion) of
> have a pair literal seems much more widely useful, and would allow
> HashMap.of().


A struct-like tuple literal of any arbitrary (immutable) size would
cover even more use-cases, e.g. multiple return values in methods.


> 
> Lawrence
> 

Kai



More information about the coin-dev mailing list