Javatpoint Logo
Javatpoint Logo

Java ConcurrentHashMap putAll() Method

The 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.

Syntax

Parameter

m - mappings to be stored in this map

Returns

Have void as return type.

Throws

No exception is thrown.

Example 1

Test it Now

Output:

Mappings : {100=AAA, 101=BBB, 102=CCC, 103=DDD, 104=EEE}
New mappings : {100=AAA, 101=BBB, 102=CCC, 103=DDD, 104=EEE}

Example 2

Test it Now

Output:

Mappings : {K1=AAA, K2=BBB, K3=CCC, K4=DDD, K5=EEE}
New mappings : {K1=AAA, K2=BBB, K3=CCC, K4=DDD, K5=EEE}





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA