R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which collector works well with Enum keys to produce an `EnumMap`?

  • (A) groupingBy() with EnumMap::new
  • (B) toMap() with Enum::valueOf
  • (C) partitioningBy() with EnumMap
  • (D) mapping() with EnumMap
  • Correct Answer - Option(A)
  • Views: 7
  • Filed under category Java
  • Hashtags:

Explanation by: Ram Sharma
`groupingBy()` can take a `MapFactory` like `EnumMap::new` to create enum-based maps.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.