Java EnumMap putAll() methodThe putAll() method of Java EnumMap class is used to copy all the mappings from one EnumMap to a new EnumMap. SyntaxParametersm - the map which is to be copied to the newer one. ReturnsThis method does not return any value. ExceptionNullPointerException - if the given map is null, or if one or more keys in the given map are null. Example 1Test it NowOutput: Map1: {Monday=1, Tuesday=2, Wednesday=3} Map2: {} Map1: {Monday=1, Tuesday=2, Wednesday=3} Map2: {Monday=1, Tuesday=2, Wednesday=3} Example 2Test it NowOutput: Map1: {Java=1, CSS=2, Python=3, Android=4} Map2: {} Map1: {Java=1, CSS=2, Python=3, Android=4} Map2: {Java=1, CSS=2, Python=3, Android=4}
Next TopicJava EnumMap
|