The
keys() method of
ConcurrentHashMap class in Java is used to get the enumeration of the keys present in the hashmap.
Syntax:
Enumeration enu = ConcurrentHashMap.keys()
Parameters: The method does not take any parameters.
Return value: The method returns an enumeration of the keys of the ConcurrentHashMap.
Below programs are used to illustrate the working of the keys() method:
Program 1:
Output:
The Map is: {20=Geeks, 25=Welcomes, 10=Geeks, 30=You, 15=4}
The enumeration of keys are:
20
25
10
30
15
Program 2: