To get keys in HashMap, We have keySet() method which is present in java.util.Hashmap
package.
ex :
Map<String,String> map = new Hashmap<String,String>();
map.put("key1","value1");
map.put("key2","value2");
// Now to get keys we can use keySet() on map object
Set<String> keys = map.keySet();
Now keys will have your all keys available in map. ex: [key1,key2]