The full picture
| Need | Use | Why |
|---|---|---|
| Fast lookup, no order | HashMap / HashSet | O(1) expected |
| Predictable iteration order | LinkedHashMap / LinkedHashSet | hash speed + insertion order; LRU via access-order |
| Sorted keys, range queries | TreeMap / TreeSet | red-black tree; headMap, ceilingKey, subSet |
| Enum keys | EnumMap / EnumSet | array/bitset backed — fastest and smallest |
| Queue/stack both ends | ArrayDeque | ring buffer; beats Stack & LinkedList |
| Priority scheduling | PriorityQueue | binary heap; note: iteration is NOT sorted |
| Read-mostly listeners | CopyOnWriteArrayList | snapshot iteration, zero read locking |
Two habits mark a senior: (1) program to the interface — return List/Map/Collection from APIs, keep the implementation swappable; (2) immutability at boundaries — expose List.copyOf(...)/unmodifiable views so callers can't mutate your internals. Also know that TreeMap requires a total order consistent with equals, or Set semantics quietly break.