Home » Java ConcurrentHashMap containsKey() Method

Java ConcurrentHashMap containsKey() Method

by Online Tutorials Library

Java ConcurrentHashMap containsKey() Method

The containsKey() method of ConcurrentHashMap class tests if the specified object is a key in this table.

Syntax

Parameter

key – possible key

Returns

true if and only if the specified object is a key in this table, as determined by the equals method; false otherwise

Throws

NullPointerException

Example 1

Test it Now

Output:

Mappings are: {python=20, c++=30, java=10, c=25, .net=15}  is java  present? ::  true  

Example 2

Test it Now

Output:

Mappings are: {python=20, c++=30, java=10, c=25, .net=15}  is javascript  present? ::  false  

You may also like