Chapter 7

The Java Collections Framework and Generics

Learning Objectives

By the end of this lesson, you will be able to:

  • Use collections to process data
  • Compare objects in different ways
  • Sort collections of objects
  • Use collections to build efficient algorithms
  • Use the best-suited collection for each use case

Introduction

In previous lessons, you learned how objects can be grouped together in arrays to help you process data in batches. Arrays are really useful but the fact that they have a static length makes them hard to deal with when loading an unknown amount of data. Also, accessing objects in the array requires you to know the array's index, otherwise traversing the whole array is necessary to find the object. You also learned briefly ...

Get Java Fundamentals now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.