Java ConcurrentHashMap toString() MethodThe 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 ("{}"). SyntaxParameterNo parameter is passed. Returnsa string representation of this map ThrowsNo exception is thrown. Example 1Test it NowOutput: HashMap values : {k1=100, k2=200, k3=300, k4=400} New HashMap after remove : {k1=100, k3=300, k4=400} Example 2Test it NowOutput: mymap2 :{1=101, 2=102, 3=103} mymap :{AA=Java, BB=angular, CC=JavaScript} comparing mymap and mymap2 :false
Next TopicJava ConcurrentHashMap
|