VOOZH about

URL: https://www.geeksforgeeks.org/java/enummap-keyset-method-in-java/

⇱ EnumMap keySet() Method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

EnumMap keySet() Method in Java

Last Updated : 13 Jul, 2018
The Java.util.EnumMap.keySet() method in Java is used to return the set view of the keys contained in the map. Syntax:
Enum_Map.keySet()
Parameters: The method does not accept any argument. Return Value: The method returns the set view of the keys contained in the map. Below programs illustrate the keySet() function: Program 1:
Output:
Mappings: {India=61.7%, United_States=18.2%, China=2.5%}
Set view of the key: [India, United_States, China]
Program 2:
Output:
Mappings: {Global_today=799, India_today=69}
Set view of the key: [Global_today, India_today]
Comment