Was the Inclusion of Generics in Java 5.0 Worthwhile? [closed]
Aside from the added complexity, do you think that the inclusion of the Generics Mechanism in Java 5.0 was worthwhile?
Couldn't live without it! Do you want to go back to casting-from-Object in every container access and dealing with the resulting runtime-revealed type errors?! Basically destroys any rationale for using an allegedly statically typed language (and if I use a dynamically typed language, it's going to be Python or Javascript, not Java;-). Generics are a must for me.
Yes. Each and every cast in a Java program is a ClassCastException waiting to happen. Hence, using generics to avoid casting in the first place, means you have less opportunity for failure.
Perhaps you need to have programmed in a language with strong typing to appreciate that. I can recommend Haskell for this.
Yes, generics is usefull to check types in compilation time
精彩评论