Java ConcurrentHashMap clear() MethodThe clear() method of Constructor class removes all of the mappings from this map. SyntaxParameterNo any parameter is passed. ReturnsNA ThrowsNo exception is thrown. Example 1Test it NowOutput: Values in map: {1=1, 2=10, 3=100, 4=2, 5=20, 6=200} Map after calling clear(): {} Example 2Test it NowOutput: Values in map: {a=1, b=10, c=100, d=2, e=20, f=200} Map after calling clear(): {}
Next TopicJava ConcurrentHashMap
|