RecapDifficulty: Advanced1 min

Recap: Generics

Earlier errors, erasure, invariance, wildcards, and what erasure forbids, with where each was.

Generics come down to the five ideas below, each listed with the card that covers it.

What the topic established, and which card it was on
The ideaWhere
A type parameter moves a failure from the reading line to the writing lineGenerics: Moving a Type Error From Run Time to Compile Time
Type arguments are erased, so List<String> is a List at run timeType Erasure: What Is Left of List<String> at Run Time
A List<String> is not a List<Object>, because adding would corrupt itWhy a List<String> Is Not a List<Object>
Producer extends, consumer super: the wildcard states the directionBounded Wildcards: ? extends and ? super
new T[], new T(), instanceof T and T.class are all refusedErasure Limits: Why You Cannot Write new T[]

Every awkward rule here is erasure: the compiler knows the type argument and the runtime does not, so what can be checked early is, and what needs the type while running is refused.