Understanding Generics

In the previous article, we learned about the basics of generics and its usage. In this article, we’ll go one level down and understand the semantics of generics and how compiler handles generics code. To quickly recap, generics provides compile-time safety. When we provide the type information in the angle brackets (< … >), the compiler will use this type of information to make sure that we do not put objects with different type into the collection. This safety check happens at compile time only. Generics can also be used for method parameters for the type safety of arguments, and […]

Understanding Generics Read More »