What are the benefits of Java's types erasure?

后端 未结 11 1694
夕颜
夕颜 2020-11-28 01:45

I read a tweet today that said:

It\'s funny when Java users complain about type erasure, which is the only thing Java got right, while ignoring all th

11条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-28 02:29

    avoids c++-like code bloat because the same code is used for multiple types; however, type erasure requires virtual dispatch whereas the c++-code-bloat approach can do non-virtually dispatched generics

提交回复
热议问题