Card 08/ 08
Recap: The Collections Framework
Three promises, contains on a list and a set, declared types, Map's views and unmodifiable lists.
The Collections Framework comes down to the five ideas below, each listed with the card that covers it.
| The idea | Where |
|---|---|
List keeps order and duplicates, Set keeps each once, Queue decides what is next | Collection Interfaces: List, Set and Queue |
contains walks a list and is one lookup on a hash set | List vs Set vs Queue |
Name the interface everywhere except after new | Declaring the Interface Type, Not the Class |
Map holds pairs, sits outside Collection, and offers three views | Why Map Is Not a Collection |
List.of is unmodifiable, and add throws rather than failing to compile | Unmodifiable Lists: Why List.of(...) Refuses add() |
Choose the interface from the promise you need, and the class afterwards.
← → move through sections and cards