R

Ram Sharma • 3.40K Points
Extraordinary

Q. How do you ensure immutability with `groupingBy()` results?

  • (A) Use `toUnmodifiableList()` as downstream
  • (B) Use `toList()` directly
  • (C) Apply `sorted()`
  • (D) Use `toSet()` only
  • Correct Answer - Option(A)
  • Views: 8
  • Filed under category Java
  • Hashtags:

Explanation by: Ram Sharma
You can use `groupingBy(..., toUnmodifiableList())` to make the collected lists unmodifiable.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.