Chapter 7. Collections and Generics
As you start to use your growing knowledge of objects to handle more and more interesting problems, one recurring question will emerge: How should you store the data you’re manipulating in the course of solving those problems? You’ll definitely use variables of all the different types, but you’ll also need bigger, fancier storage options. The arrays we discussed back in “Arrays” are a start, but arrays have some limitations. In this chapter, you will see how to get efficient, flexible access to large amounts of data using Java’s idea of collections. You’ll also learn how to deal with the various types of data you want to store in these big containers, like you do with individual values in variables. That’s where generics come in. We’ll get to those in “Enter Generics”.
Collections
Collections are data structures that are fundamental to all types of programming. Whenever you need to refer to a group of objects, you have some kind of collection. At the core ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access