Chapter 11. Collections and Maps

Exam Objectives

  • Make appropriate selection of collection classes/interfaces to suit specified behavior requirements.

  • Distinguish between correct and incorrect implementations of hashCode() (and equals()) methods.

Supplementary Objectives

  • Identify the core collection interfaces and their inheritance relationships: Collection, Set, SortedSet, List, Map, SortedMap.

  • Understand the differences between collections and maps.

  • Understand the operations performed by the addAll(), removeAll(), and retainAll() methods in the Collection interface.

  • Recognize destructive and non-destructive collection operations.

  • Understand how data can be passed between collections.

  • Identify the implementations of the core collection interfaces and state their usage: HashSet, TreeSet, LinkedHashSet, ArrayList, Vector, LinkedList, HashMap, Hashtable, TreeMap, LinkedHashMap.

  • Write code to create views on collections.

  • Use an iterator to traverse all the elements of a collection.

  • Distinguish between unordered, ordered, and sorted collections.

  • Understand the natural ordering of elements provided by the Comparable interface and the total ordering imposed by the Comparator interface.

  • State the conditions under which an UnsupportedOperationException may occur in collections.

  • Identify the methods in the Collections class that can be used to produce immutable and thread-safe versions of various types of collections.

  • State the major algorithms provided by the Collections class.

  • Write code to pass data between arrays and collections.