Quote:Original post by princec
Generics can't remove run-time overhead as they are implemented using a technique called type erasure. The bytecode generated has no knowledge of generics at all. The compiler inserts casts in the code having already trapped most of the potential ClassCastExceptions at compile time.
However you should know that a runtime cast is an incredibly fast operation and nothing you should be concerned about.
Cas :)
Thanks, I'm not overly concerned about the operation. (Its probably on par with bounds checking an array, but doing a lot of that can make a program slow. Which it probably is checking some constant from the byte-code generation.)
Can you explain "type erasure" or point to some documentation please.
Thanks,
L-
[Edit:] Actually nevermind. Google found it for me, thanks.