Javatpoint Logo
Javatpoint Logo

Java EnumMap containsValue() method

The containsValue() method of Java EnumMap class is used to check whether one or more key is associated with a given value or not. This method returns true if the specified value is mapped by any of the keys in the map.

Syntax

Parameters

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

Returns

This method returns true if this map maps one or more keys to this value.

Exception

NA

Example 1

Test it Now

Output:

Map: {Java=1, Python=2, PHP=3, Android=4, AngularJS=5}
Map contains '1': true
Map contains '5': true

Example 2

Test it Now

Output:

Map: {Monday=1, Tuesday=2, Wednesday=3, Thursday=4}
Map contains '2': true
Map contains '4': true
Next TopicJava EnumMap



Help Others, Please Share

facebook twitter pinterest