O'Reilly logo

Core Java™, Volume I–Fundamentals, Eighth Edition by Gary Cornell, Cay S. Horstmann

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 12. Generic Programming

WHY GENERIC PROGRAMMING?

DEFINITION OF A SIMPLE GENERIC CLASS

GENERIC METHODS

BOUNDS FOR TYPE VARIABLES

GENERIC CODE AND THE VIRTUAL MACHINE

RESTRICTIONS AND LIMITATIONS

INHERITANCE RULES FOR GENERIC TYPES

WILDCARD TYPES

REFLECTION AND GENERICS

Generics constitute the most significant change in the Java programming language since the 1.0 release. The addition of generics to Java SE 5.0 was the result of one of the first Java Specification Requests, JSR 14, that was formulated in 1999. The expert group spent about five years on specifications and test implementations.

Generics are desirable because they let you write code that is safer and easier to read than code that is littered with Object

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required