Lists, sets and maps
Keep many values together: lists of players, sets of toggles and maps of coins.
This page is still being written.
What it will cover
- Arrays briefly, then List/ArrayList: add, get, size, remove, contains, sort; List.of immutability trap
- Set/HashSet for unique things (players with flight enabled)
- Map/HashMap: put, get, getOrDefault, containsKey, remove, merge, entrySet loops; Map<UUID, Integer> coins
- Generics in angle brackets explained simply; why List<int> fails (boxing, Integer)
- Iterating and removing safely (removeIf, ConcurrentModificationException)
- Choosing the right collection (table)
- LinkedHashMap for order and TreeMap for sorted leaderboards
- Runnable examples: party list, toggle set, coin bank, top-3 leaderboard