Errors and collections
Exceptions, lists and maps, and sets, queues and stacks.
About 5 hours of study
Learning objectives
- Handle and throw exceptions
- Store data in lists and maps
- Use sets, queues and stacks
Lessons
- 1
Exceptions Intermediate
How Java reports errors with exceptions: try, catch and finally, checked and unchecked exceptions, throwing your own, declaring them with throws, and the common runtime exceptions.
- 2
Lists and maps Intermediate
The two collections Java programs use most: ArrayList for ordered lists that grow, and HashMap and TreeMap for looking values up by key, with generics, wrapper types and iteration.
- 3
Sets, queues and stacks Intermediate
Collections for uniqueness and order of processing: HashSet, TreeSet and LinkedHashSet, queues and stacks with ArrayDeque, PriorityQueue, and how equals and hashCode decide what counts as the same.
Module practice
- Java: Average the numbers, skip the restEasy
- Java: Validate records with your own exceptionMedium
- Java: A stack machine that reports errorsHard
- Java: A shopping listEasy
- Java: The most frequent wordsMedium
- Java: A gradebook of lists in a mapHard
- Java: Unique visitorsEasy
- Java: Check brackets with a stackMedium
- Java: A task scheduler with a priority queueHard