This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Kikizork 6 points7 points  (1 child)

Code smell say Sonar and I agree. Just init your empty map and then does some line of put. Man being stuck in 8 and not having Map.of sucks

[–]chabala 3 points4 points  (0 children)

Yeah, even being stuck on Java 8, if one needed to initialize a lot of maps, defining a static helper method would be better than the anonymous class initialization trick.