87
Java ConcurrentHashMap toString() Method
The toString() method of ConcurrentHashMap class returns a string representation of this map. The string representation consists of a list of key-value mappings (in no particular order) enclosed in braces (“{}”).
Syntax
Parameter
No parameter is passed.
Returns
a string representation of this map
Throws
No exception is thrown.
Example 1
Output:
HashMap values : {k1=100, k2=200, k3=300, k4=400} New HashMap after remove : {k1=100, k3=300, k4=400}
Example 2
Output:
mymap2 :{1=101, 2=102, 3=103} mymap :{AA=Java, BB=angular, CC=JavaScript} comparing mymap and mymap2 :false
Next TopicJava ConcurrentHashMap