EEMI

Guided Notes

Collections

List, ArrayList, and LinkedList; Set and HashSet; Map and HashMap; sorting; iterators; and wrapper classes.

The Collections Framework

Slide 1 / 5

java.util provides ready-made data structures that grow and shrink automatically:

• List — an ordered sequence that allows duplicates (ArrayList, LinkedList). • Set — unique values only (HashSet, TreeSet, LinkedHashSet). • Map — key–value pairs with unique keys (HashMap, TreeMap, LinkedHashMap).

Declare variables by the interface and create by the class: List<String> names = new ArrayList<>();

The <String> is a generic type: the list only holds Strings.

← Files & I/O