Java ConcurrentHashMap containsValue() MethodThe containsValue() method of ConcurrentHashMap class returns true if this map maps one or more keys to the specified value. Note: This method may require a full traversal of the map, and is much slower than method containsKey. SyntaxParametervalue - value whose presence in this map is to be tested Returnstrue if this map maps one or more keys to the specified value ThrowsNullPointerException Example 1Test it NowOutput: Mappings are: {AAA=10, CCC=25, BBB=15, EEE=30, DDD=255} is 255 present? :: true Example 2Test it NowOutput: ConcurrentHashMap values : {A=26, B=98, C=55} new ConcurrentHashMap after computeIfPresent : {A=26, B=98, C=155} is 98 is present : true
Next TopicJava ConcurrentHashMap
|