Java ConcurrentHashMap putAll() MethodThe putAll() method of ConcurrentHashMap class copies all of the mappings from the specified map to this one. These mappings replace any mappings that this map had for any of the keys currently in the specified map. SyntaxParameterm - mappings to be stored in this map ReturnsHave void as return type. ThrowsNo exception is thrown. Example 1Test it NowOutput: Mappings : {100=AAA, 101=BBB, 102=CCC, 103=DDD, 104=EEE} New mappings : {100=AAA, 101=BBB, 102=CCC, 103=DDD, 104=EEE} Example 2Test it NowOutput: Mappings : {K1=AAA, K2=BBB, K3=CCC, K4=DDD, K5=EEE} New mappings : {K1=AAA, K2=BBB, K3=CCC, K4=DDD, K5=EEE}
Next TopicJava ConcurrentHashMap
|