Java ConcurrentHashMap getOrDefault() MethodThe getOrDefault() method of ConcurrentHashMap class returns the value to which the specified key is mapped, or the given default value if this map contains no mapping for the key. SyntaxParameterkey - the key whose associated value is to be returned defaultValue - the value to return if this map contains no mapping for the given key Returnsthe mapping for the key, if present; else the default value ThrowsNullPointerException Example 1Test it NowOutput: Id is : 8888 JavaTpoint
Next TopicJava ConcurrentHashMap
|