Java Snippet
Stream toList Collector
Difficulty: Easy
Collecting a stream into a `List` is the most common terminal operation in modern Java. This snippet shows the three idiomatic options: the legacy `Collectors.toList()`, the unmodifiable `Collectors.toUnmodifiableList()` (Java 10+), and the convenient `Stream.toList()` shortcut (Java 16+). Pick the unmodifiable variant for return values to prevent caller mutation.
