R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which of the following collectors creates an immutable set?

  • (A) Collectors.toSet()
  • (B) Collectors.toCollection(TreeSet::new)
  • (C) Collectors.toUnmodifiableSet()
  • (D) Collectors.unmodifiableSet()
  • Correct Answer - Option(C)
  • Views: 6
  • Filed under category Java
  • Hashtags:

Explanation by: Ram Sharma
`Collectors.toUnmodifiableSet()` returns a set that is unmodifiable.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.