0 votes
in JAVA by
How HashSet works internally in Java?

1 Answer

0 votes
by

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.

...