generics
type parameters, wildcards, erasure. how java gets type safety without changing the JVM.
- 01why generics existlife before generics was ClassCastException at 3am.
- 02generic types and methodswriting your own Box<T>, and how inference figures out T.
- 03bounded type parameters<T extends Comparable<? super T>> decoded.
- 04wildcards and PECS? extends vs ? super. producer extends, consumer super.
- 05type erasurewhat the compiler deletes, what it adds (bridge methods), and why.
- 06arrays, varargs and other limitsno new T(), no generic arrays, heap pollution and @SafeVarargs.
- 07generics at runtimetype tokens and the bits of type info that do survive erasure.