Primitives in Generics proposal.
abies at adres.pl
abies at adres.pl
Wed Mar 10 05:42:52 PST 2010
"Reinier Zwitserloot" <reinier at zwitserloot.com> napisał(a):
> I'll rebut point by point;
>
> 1: int[] <-> Integer[] conversion doesn't preserve reference identity.
>
> This rule has been broken before. In java 1.5, this assert isn't true,
> because reference identity isn't maintained when boxing is applied:
>
> Integer x = new Integer(10000000);
> int y = x;
> Integer z = x;
> assert z == x; //This will fail!
There is a big difference - Integer is immutable. Array is inherently mutable and if you add it to some generic container and then mutate contents of that array through outside reference, internal copy will not be changed.
Regards,
Artur Biesiadowski
More information about the lambda-dev
mailing list