Although HashSets and HashMaps implement different interfaces. A HashSet is essentially using a HashMap Instance for its internal implementation.
You can confirm this at the official documentation at - https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html
OR
Read a Medium post at -
https://medium.com/@liberatoreanita/working-with-hashset-in-java-8993b411e3a9