What is the difference between `Collectors.toUnmodifiableList()` and `Collections.unmodifiableList(Collectors.toList())`?

Java Hard
Select the correct answer: Single Choice

Key points

  • `toUnmodifiableList()` ensures immutability and no nulls in Java 10+
  • `unmodifiableList(toList())` wraps a mutable list and allows null values
  • Understanding the distinction is important for proper list handling in Java

Ready to go further?