Chapter 21. Collections

 

ANDREA: Unhappy the land that has no heroes. GALILEO: No, unhappy the land that needs heroes.

 
 --Bertolt Brecht, Life of Galileo

The java.util package contains many useful interfaces, classes, and a range of subpackages. The classes and interfaces can be roughly divided into two categories: collections and everything else. This chapter describes the collection types. You will learn about the other general utilities in the next chapter.

Collections

Collections (sometimes called containers) are holders that let you store and organize objects in useful ways for efficient access. What will be efficient depends on how you need to use the collection, so collections come in many flavors. Most programming environments provide some ...

Get THE Java™ Programming Language, Fourth Edition now with O’Reilly online learning.

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