Prefer using parameterized types over raw types

When generics were introduced in JDK 1.5, raw types were retained only to maintain backwards compatibility with older versions of Java. Although using raw types is still possible, they should be avoided for following reasons :

  • they usually require casts
  • they aren’t type safe, and some important kinds of errors will only appear at runtime
  • they are less expressive, and don’t self-document in the same way as parameterized types

Unless you are using a JDK version prior to 1.5 I don’t see a reason why you should not use parameterized types in your code.

Happy coding !!

Similar Articles

Linked data based integration
New Date and Time API in Java8
Re-platformig this blog to Wintersmith
Improving code quality in agile teams
Java7 updates

blog comments powered by Disqus