learnstuff logo

Generics

Learn the concepts of generics, the mechanism that ensures and enforces compile-time type safety in Java. This mechanism uses parameters when defining classes, interfaces and methods. Much like formal parameters used in method declarations, type parameters provide a way for you to re-use the same code with different inputs. The difference is that the inputs to formal parameters are values, while the inputs to type parameters are types.