Java ConcurrentHashMap get() MethodThe get() method of ConcurrentHashMap class returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. SyntaxParameterkey - the key whose associated value is to be returned Returnsthe value to which the specified key is mapped, or null if this map contains no mapping for the key ThrowsNullPointerException. Example 1Test it NowOutput: mappings are: {1=AA, 2=BB, 3=CC, 4=DD, 5=EE} Value : null Value : DD Example 2Test it NowOutput: mappings are: {A1=AA, A2=BB, A3=CC, A4=DD, A5=EE} Value : AA Value : EE
Next TopicJava ConcurrentHashMap
|