Generics refer to the use of type parameters, which provide a way to define methods, classes and interfaces that can operate with different data types. The benefits of generics is that they provide compile-time type safety, and that they eliminate the need for most type conversions.

Generic classes

Generic classes allow class members to use type parameters. Such a class is defined by adding a type parameter section after the class name, which contains a type parameter enclosed between angle brackets. The naming convention for type parameters is that they should consist of a single uppercase letter. Typically, the letter ...

Get Java Quick Syntax Reference now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.