Interview replay
Full round replay — variance
Timed verbal replay with pass/fail criteria per follow-up.
How to run this
The opener
“Why is List<String> not a List<Object>?”
Budget: 45 seconds. Going long here is itself a fail signal.
Follow-ups
1. “Arrays are covariant and generics are not. Is that inconsistent?”
Testing: Do they know array covariance is a 1.0 artefact with a runtime cost?
Scoring
Pass: Inconsistent and deliberate. Array covariance predates generics and costs a store check on every array write, with ArrayStoreException when it fails. Generics chose compile-time prevention instead.
Fail: 'Arrays are different' with no mechanism, or does not know ArrayStoreException exists.
2. “What is PECS, and how do you actually decide?”
Testing: Can they turn the mnemonic into a question they can answer at a keyboard?
Scoring
Pass: Producer extends, Consumer super — and reframes it as 'does my method read from this collection or write to it?'. Notes that a method doing both gets no wildcard.
Fail: Recites the letters without being able to apply them to a signature.
3. “Why can't you add to a List<? extends Number>?”
Testing: Capture. The best single separator on this topic.
Scoring
Pass: The compiler captures the wildcard as a fresh type variable — CAP#1 — and knows only that it extends Number. It might be a List<Double>, so no value is provably safe. null is the exception.
Fail: 'Because it's read-only', stated as a rule with no reason.
4. “What can you read out of a List<? super Integer>?”
Testing: The mirror image.
Scoring
Pass: Object, and nothing narrower. The element type is Integer or wider, and the widest possibility is Object.
Fail: 'Integer' — the most common wrong answer here.
5. “Why is Stream.map declared Function<? super T, ? extends R>?”
Testing: Can they read a real JDK signature?
Scoring
Pass: The mapper consumes T and produces R, so each half follows PECS independently. It lets a Function<Object, String> be passed where a Function<String, CharSequence> is expected.
Fail: 'For flexibility' with no per-half reasoning.
6. “Where should a wildcard never appear?”
Testing: Judgement, not rules.
Scoring
Pass: Return types — it pushes the capture onto every caller and the wildcard spreads through their code. Wildcards belong on parameters, where they widen what may be passed.
Fail: No opinion, or 'use them everywhere for flexibility'.