The reversed view is obtained BEFORE the two mutations, and both mutations are applied to base, not to view. What does this print?
```java
import java.util.*;
public class Main {
public static void main(String[] args) {
List<String> base = new ArrayList<>(List.of("a", "b", "c"));
List<String> view = base.reversed();
base.addLast("d");
base.removeFirst();
System.out.print(view);
}
}
```
A. [d, c, b]Correct answer
Correct: reversed() is a live view, not a copy, so after addLast and removeFirst the backing list is [b, c, d], and reading the view walks it backwards to [d, c, b].
B. Throws ConcurrentModificationException
Confuses a view with an iterator; a reversed view is re-read from the backing list on every operation and is not iterating, so mutating the source between creation and use is legal, not a ConcurrentModificationException.
C. [d, c, b, a]
A half-live belief that additions to the backing list show through but removals do not; a view holds no state of its own, so both writes are equally visible and a is genuinely gone.
D. [c, b, a]
The snapshot misconception: assumes reversed() eagerly builds a reversed copy at the call, freezing the original three elements; the view references the list, not its contents.
Explanation
Trace: `reversed()` does not copy anything — it returns a live, reverse-ordered *view* backed by the same list. Nothing is snapshotted at the moment `view` is created. The two mutations run against `base`: `addLast("d")` makes it `[a, b, c, d]`, then `removeFirst()` makes it `[b, c, d]`. Printing `view` walks that current content backwards, giving `[d, c, b]`.
Why the others are wrong:
`[c, b, a]` is the snapshot misconception — it is what you get if you believe `reversed()` eagerly builds a reversed copy at the point of the call, freezing the original three elements. The view holds a reference to the list, not to its contents.
`[d, c, b, a]` encodes a half-live belief: additions to the backing list show through but removals do not. A view has no state of its own to be stale, so both writes are equally visible; `a` is genuinely gone from the backing list.
`Throws ConcurrentModificationException` confuses a view with an iterator. Iterators are fail-fast and do detect structural modification of their source, but a reversed view is not iterating — it is re-read from the backing list on every operation, so mutating the source between creation and use is entirely legal.
Exam tip: every `reversed()` in JEP 431 (List, SequencedSet, SequencedMap, Deque) is a view, never a copy — writes flow both ways and reads are always current. The reverse trap is just as common: mutating through `reversed()` changes the ORIGINAL collection, so `list.reversed().addFirst(x)` appends `x` to the tail of `list`.