Introduction to Generics
Generics were introduced in Java 5 (JDK 1.5) to provide tighter type checks at compile time and to support generic programming.
Generic Classes
A class that can refer to any type is known as a Generic Class.
Generic Methods
Just as you can define generic classes, you can also define Generic Methods.
Wildcards in Generics
In generic code, the question mark (?), called the wildcard, represents an unknown type.
Type Erasure
One of the most important concepts to understand about Java Generics is that Generics do not exist at runtime.