You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 1. Internally, Java uses a HashMap to implement HashSet, it just inserts a dummy object as value into the map: private static final Object PRESENT = new Object();
20
+
* you can step into the java.util.HashSet library to see this:
21
+
* public boolean add(E e) {
22
+
* return map.put(e, PRESENT)==null;
23
+
* }
24
+
* 2. https://medium.com/javarevisited/internal-working-of-hashset-in-java-interview-question-129bdd31fc60 for more references/
0 commit comments