| Summary: | Java generics are the exciting new feature of Java 5 (renamed from J2SE 1.5) due for release shortly. Much controversy surrounds generics. In fact, Sam Pullara suggests that generics are just a really complicated way of implementing autocasting. In this article, Conan Dalton attempts to present one of the bright sides of generics: the ability to enforce stricter type safety-in particular, a kind of type safety that can not be achieved with autocasting. Dalton uses a simple but reusable event-dispatching mechanism for an example and compares a generics-aware implementation with a non-generics-aware implementation. He explains some of the more obtuse elements of the new Java syntax and, in conclusion, suggests that generics may have a different impact depending on whether you are an API client or an API developer. (1,300 words September 20, 2004)
|