Why aren't the generic Java type parameters repeated at run time?

My understanding is that C # and java are somewhat different from generics, one of which is that parameters of a universal type are available at runtime in C # /. NET, but not in Java. Why did Java designers do it like this?

+5
source share
2 answers

Allow binary compatibility with pre-generics bytecode, which allows the new code to interact with the old code.

On the Erasure Type page in Java Tutorials:

Java Java , .

[...]

, .

# vs Java generics.

+9

, - Hardcore Java:

- ; - - O (n). 10 , . , 15 000 , , - .

, , , . , , . , .

"" , , , . , - , , - Java. :

, , . . , Sun, , , JDK, JDK 1.5.

, , ?

+4

All Articles