map collection factory

Map Collection Factory Java Challenge

In Java 9 we can use Collection Factory with List, Set, or Map. This makes code more concise and easier to read because we don’t need to add element per element in the Map.

Therefore, it’s time to try this fun Java Challenge! Are you ready for the challenge? Check this out:

[qsm quiz=17]

That’s it challenger, keep breaking your Java limits and solving the Java Challenges!

Written by
Rafael del Nero
Join the discussion

4 comments
  • The is an Error in the Answer! The right answer is:
    java.lang.UnsupportedOperationException will be thrown

    Here comes the error line taken from the program execution log:
    “Exception in thread “main” java.lang.UnsupportedOperationException”

  • I made the Java challenge code and the answer was: Exception in thread “main” java.lang.IllegalArgumentException: duplicate key: no.
    The error was in line 5

Senior Java Interview Questions from Global Companies

Includes detailed answers and practical explanations from real interviews.

Delivered to your email within minutes.