Choosing a Collection

The documentation for each collection discusses its memory requirements and its methods’ performance characteristics for operations such as adding and removing elements, searching for elements, sorting elements and more. Before choosing a collection, review the online documentation for the collection category you’re considering (Set, List, Map, Queue, etc.), then choose the implementation that best meets your application’s needs. Chapter 19, Searching, Sorting and Big O, discusses a means for describing how hard an algorithm works to perform its task—based on the number of data items to be processed. After reading Chapter 19, you’ll better understand each collection’s performance characteristics as described in the online ...

Get Java™ How To Program (Early Objects), Tenth Edition 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.