15. Generics

Objectives

In this chapter you’ll learn:

• To create generic methods that perform identical tasks on arguments of different types.

• To create a generic Stack class that can be used to store objects of any class or interface type.

• To understand how to overload generic methods with non-generic methods or with other generic methods.

• To understand raw types and how they help achieve backward compatibility.

• To use wildcards when precise type information about a parameter is not required in the method body.

• The relationship between generics and inheritance.

Every man of genius sees the world at a different angle from his fellows.

Havelock Ellis

...our special individuality, as distinguished from our generic humanity.

Oliver ...

Get Java™ for Programmers: Deitel now with O’Reilly online learning.

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