Re:Next-gen Java Programming Style
by brunomlopes on Monday August 10, 2009 @01:49PM
(#753530)
Not only does that require reflection, it is very error prone and not refactor-friendly. Just change the type of the list, change the method, and it will blow up on runtime instead of compile time.
In my opinion, that goes against the grain of Java (and c#, in a way) of having the compiler doing a lot of checking for you.
Google's approach, while more verbose, is a bit safer and more idiomatic.
Google's approach, while more verbose, is a bit safer and more idiomatic.