Question d’entretien chez Deutsche Bank

How HashSet works internally in Java?

Réponse à la question d'entretien

Utilisateur anonyme

22 sept. 2024

HashSet is internally implemented using an HashMap. Since a Map needs key and value, a default value is used for all keys. Similar to HashMap, HashSet doesn't allow duplicate keys and only one null key, I mean you can only store one null object in HashSet.