D
Dave Stallard
I have a question about the new Generics mechanism which articles I've
read have left me still a little uncertain about. Suppose you have
(say) a List whose elements are of class Foo. Objects of this type
would be declared as:
List<Foo> x = new List<Foo>();
Now suppose you do lookup or iteration:
Foo f = x.get(0);
With Generics, there is no longer a need to insert an explicit cast.
BUT, underneath the hood in the implementation, is there a still a cast
being performed at runtime in a statement like the one above? I
certainly hope not, since I know that runtime casts introduce a
performance penalty.
Dave
read have left me still a little uncertain about. Suppose you have
(say) a List whose elements are of class Foo. Objects of this type
would be declared as:
List<Foo> x = new List<Foo>();
Now suppose you do lookup or iteration:
Foo f = x.get(0);
With Generics, there is no longer a need to insert an explicit cast.
BUT, underneath the hood in the implementation, is there a still a cast
being performed at runtime in a statement like the one above? I
certainly hope not, since I know that runtime casts introduce a
performance penalty.
Dave