tags:

views:

91

answers:

3

Aside from the added complexity, do you think that the inclusion of the Generics Mechanism in Java 5.0 was worthwhile?

+12  A: 

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.

Alex Martelli
+1  A: 

Yes, generics is usefull to check types in compilation time

Topera
+2  A: 

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.

Thorbjørn Ravn Andersen