Module 03 of 10

Collections & Generics

Lessons

About This Module

Almost every real program works with groups of data: a list of orders, a set of unique users, a map from IDs to records. Java's Collections Framework gives you ready-made, well-tested structures for all of these, and knowing which one to reach for is a core part of writing good Java.

You'll learn the main interfaces and their common implementations: List for ordered items, Set for unique items, Map for key-value pairs, and Queue for processing in order. You'll also see how sorting works with Comparable and Comparator. Then generics show how these collections stay type-safe, and how to write your own reusable classes and methods that work with any type.

With collections and generics in hand, you'll be ready for the next module, Modern Java: Lambdas, Streams & Records, which uses them heavily to process data in a concise, functional style.

Lessons

4 videos
01

Java Collections: List, Set, Map, Stack and Queue Explained

A walk through the basic elements of the Collections Framework and what each of List, Set, Map, Stack, and Queue is for.

02

Learn Java Collections in 1 Hour

A fuller tour of the framework: ArrayList, LinkedList, HashSet, TreeSet, HashMap, TreeMap, queues, and iterators.

03

Learn Java Generics

An introduction to generics: type parameters, type arguments, and writing classes that work with different data types.

04

Java Generics Finally Explained

A deeper look at generics from first principles, including bounded types, wildcards, and the PECS rule.