What is the guarantee of generic drugs in Java?

Although I know, generics are used to make our code more general and flexible

But what is the guarantee of cast iron in generic drugs? What does it promise?

Editor: since I raised this question in the interview, I also searched on the Internet later, but only found a cast iron community, but there was no relevant guarantee

Solution

Cast iron guarantees that type conversions inserted by the compiler for generics will never fail during type erasure because there are no unchecked warnings during compilation

It basically means that the required type conversions inserted by the compiler during the compilation of generic types will not cause ClassCastException at run time, provided that there are no unchecked warnings during compilation

Literally more –

From Java genetics and collections

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>