Assuming that the word 'efficient' is the key part of your question, and depending what you want to do with the set, it might be an idea to create your own subclass of HashSet which ignores the HashSet implementation and presents a view onto the existing map, instead.
As a partially implemented example, it might look something like:
public class MapBackedHashSet extends HashSet
{
private HashMap theMap;
public MapBackedHashSet(HashMap theMap)
{
this.theMap = theMap;
}
@Override
public boolean contains(Object o)
{
return theMap.containsKey(o);
}
/* etc... */
}
If you don't know how the class will be used, you'll need to take care to override all the relevant methods.