We’re now well into our first Generic year in Java-land,
and the jury is still pretty well out.
For example, Ken Arnold
and Tor Norbye
Check out the comments on Ken’s piece for some fresh, intelligent
As for myself, I’ve just genericized a bunch of infrastructure code, and the
trade-off was pretty simple: I got rid of a ton of casts, and the
users of my APIs will get rid of even more.
On the other hand, I
picked up a few compile-time warnings—yes, I do want an array like
(And I understand that the warnings are correct, and that where
previously I had an un-flagged potential
I can’t claim that I didn’t know.)
I suppose there’s another benefit in that my APIs’ users won’t be able to put
Bicycle in a container designed to hold instances of
Fish; is that a biggie?
Personally, the compiler warnings irritate me more than the casts did, but
if what Tor and some of Ken’s commenters are saying is right,
I should just suck it up, because my users are benefiting.