Java, Spring, Microservices, Interview, Coding.
Object(); And that's how add method is implemented in HashSet class - public boolean add(E e) { return map.put(e, PRESENT)==null; } So you can see with in the internal implementation of the HashSet it’s a (key, value) pair which is actually getting added. It’s just that the actual value (which is