Java collections tutorial: Learn lists, maps and more

Become An Insider

Sign up now and get FREE access to hundreds of Insider articles, guides, reviews, interviews, blogs, and other premium content. Learn more.

Many data structures have been developed so programmers can store and retrieve values efficiently. The Java API provides implementations of common data structures and algorithms, as well as a framework to organize them. In this free PDF download, you will learn how to work with lists, sets, maps and other collections.

Key points:

  1. The Collection interface provides common methods for all collections, except for maps which are described by the Map interface.
  2. A list is a sequential collection in which each element has an integer index.
  3. A set is optimized for efficient containment testing. Java provides HashSet and TreeSet implementations.
  4. For maps, you have the choice between HashMap and TreeMap implementations. A LinkedHashMap retains insertion order.
  5. The Collection interface and Collections class provide many useful algorithms: set operations, searching, sorting, shuffling and more.
  6. Views provide access to data stored elsewhere using the standard collection interfaces.

To continue reading this article register now

Join the discussion
Be the first to comment on this article. Our Commenting Policies