By bloid
via gleichmann.wordpress.com
Published: Jan 13 2008 / 16:43
The rise of some ‘new’ languages like Ruby, Groovy and Scala is (among other things) accompanied with discussions about the verbosity of some established languages, especially Java.
For example there are not few voices, complaining about the boilerplate code that you have to write (and read) when it comes to the declaration and instantiation of collection types in Java.
Comments
dzonelurker replied ago:
How about Arrays.asList()
magle replied ago:
You're absolutely right - but i'm afraid that there would still be complaints that this isn't concise enough, i.e. when declaring a kind of matrix using Lists:
Array.asList( Array.asList( 1, 2, 3 ), Array.asList( 4, 5, 6 ), Array.asList( 7, 8, 9 ), ... )
vs.
List( List( 1,2,3 ), List( 4,5,6 ), List( 7,8,9 ), ... )
Regards
Mario
afsina replied ago:
static imports.
asList( asList( 1, 2, 3 ), asList( 4, 5, 6 ),asList( 7, 8, 9 ), ... )
but still a new syntax would not hurt.
Voters For This Link (8)
Voters Against This Link (1)