← Exit to Module 12: Generics and Type Safety lessons
Module progress · 0%Lesson · 16 min
Module 12: Generics and Type Safety
Lesson focusWildcards & Variance
Express flexible APIs with wildcard types.
01 · 12 minWhy Generics?Locked02 · 16 minGeneric Classes & InterfacesLocked03 · 15 minGeneric MethodsLocked04 · 18 minBounded Type ParametersLocked05 · 16 minWildcards & VarianceLocked06 · 14 minType Erasure & LimitationsLocked07 · 30 minMini-Project: Generic Data StructureLocked
Use unbounded wildcards (List<?>) for read-only access when type doesn’t matter.
Combine extends/super wildcards with PECS guidelines to maintain type safety.
Capture wildcards via helper methods when you need to mutate generic structures internally.