Javatpoint Logo
Javatpoint Logo

Java EnumMap containsKey() method

The containsKey() method of Java EnumMap class is used to check whether a specified key is present in this map or not. This method returns true if this map contains a mapping for the specified key.

Syntax

Parameters

key - the key whose presence in this map is to be tested

Returns

This method returns true if this map contains a mapping for the specified key.

Exception

NA

Example 1

Test it Now

Output:

{Java=1, Python=2, PHP=3, Android=4, AngularJS=5}
Tutorial.Java has a mapping:  true
Tutorial.PHP has a mapping:  true

Example 2

Test it Now

Output:

{Monday=1, Tuesday=2, Wednesday=3, Thursday=4}
Days.Tuesday has a mapping: true
Days.Thursday has a mapping: true
Next TopicJava EnumMap



Help Others, Please Share

facebook twitter pinterest