Java Type erasure

Java type erasure You can work with java generics, but still, don’t understand type erasure? Let’s look at this example: The generic T is to perform type check at compile-time. To implement this generic, the compiler will: replace the T parameter with the bound classes or Object insert type casts to Read more…

Java Generics

Generics Generics were introduced in java 5 to add stability to the code. You can add type variables to classes, interfaces and methods. Generic Class Declaration Below you see an example of generic class declaration. by writing class Box<T>, you introduce the type parameter T, that can be used anywhere in the class. Read more…