list literal gotcha and suggestion

Mark Mahieu markmahieu at
Wed Oct 7 15:43:39 PDT 2009

On 7 Oct 2009, at 23:13, Reinier Zwitserloot wrote:

> Also, it's
> obvious that Collections.unmodifiableList(Arrays.asList(item1, item2,
> item3)); is idiotic, and yet commonly used. Clearly something that
> needs fixing.]

You may view that as idiotic, but it's something I'd be quite pleased  
to see at times - the intention (and thought process behind it) would  
probably have been good, even if the actual code could be improved upon.

In a similar vein, if the 'average Java developer' knew the  
capabilities of the Collections API(s) a little better the benefits  
would (in my opinion) be far greater than the potential loss caused  
by confusing syntax etc in corner cases discussed in much of this  

I have no crying need for collection literals personally, but pushing  
them in a direction which endorses one (already over-used) core  
collection type to the detriment of another seems pretty iffy to me.



More information about the coin-dev mailing list