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

Output:

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

Example 2

Output:

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