3 ms·
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 u
by brunomlopes 17y ago
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.