Card 08/ 08
All 8 cards
RecapDifficulty: Advanced1 min
Three Promises, Many Classes
Five things this topic established, and where each one was.
| The thing | Where |
|---|---|
List keeps order and duplicates, Set keeps each once, Queue decides what is next | Three Interfaces, and the One Promise Each Makes |
contains is a walk on a list and a lookup on a set | List, Set and Queue on Order, Duplicates and Access |
Name the interface everywhere except after new | Declare the Interface, Create the Implementation |
Map holds pairs, so it sits outside Collection and offers three views instead | Why Map Is Not a Collection |
List.of is unmodifiable, and add throws rather than failing to compile | Why List.of(...) Refuses add() |
The one worth carrying: choose the interface from the promise you need, and choose the class afterwards. Every topic after this one is about the second half of that sentence.