Java SDK 1.5 'Tiger' Beta Finally Released
kingkola writes "Finally, after about two years of development, the Beta for Java SDK 1.5, aka Tiger, has been released. Features added in this edition include generics support, autoboxing of primitives, syntactic sugar for loops, enumerated types, variable arguments, sharing of memory between multiple VMs and a bunch of other bugfixes, enchancements, etc."
The reasen this can't be allowed is very simply: Look at this:
// Does not compile, but asume that it would.
// Now we have added a float to a list which can ONLY contain integers. Not good.
// Class cast exception.
ArrayList s = new ArrayList();
ArrayList t = s;
t.addElement(new Float(10.5));
Integer i= s.elementAt(0);
Allowing t=s would ruin the entire "You are sure your collection only can contain what it say it contains, and we check that at compile time"
What do you mean it does not compile??? Of course it compiles. What are you talking about? Did you mis-type?
Since when did you DEFINE that the arrayList could only contain integers??? I see no such constraint.