Slashdot Mirror


User: TomH

TomH's activity in the archive.

Stories
0
Comments
1
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 1

  1. Re:an annoying quirk on Java SDK 1.5 'Tiger' Beta Finally Released · · Score: 1

    If what you say is that you cannot pass e.g. a type ArrayList to a function that takes Arraylist, then that is completely reasonable since ArrayList can contain any type of elements and is therefore different to ArrayList.
    Inside the function you could compromise static type checking (which is essentially what the Java generics is all about) by e.g. putting Strings in the ArrayList, which would result in run-time exceptions. The generics have been introduced so that you can avoid all the annoying casting from Object to whatever type, and instead you will get compiler warnings if you access an object incorrectly. Allowing what you suggest would prevent that type of static checking from taking place, thus destroying the purpose of generics in the first place.