Java EnumMap values() method

The values() method of Java EnumMap class is used to create a collection view of the values contained in this map.

Syntax

Parameters

NA

Returns

This method returns a collection view of the mapped values.

Exception

NA

Example 1

Output:

Map: {Java=1, CSS=2, Python=3, Android=4}
Collection: [1, 2, 3, 4]

Example 2

Output:

Map: {Monday=1, Tuesday=2, Wednesday=3}
Collection: [1, 2, 3]