Java, Spring, Microservices, Interview, Coding.
the HashMap in the following way- In HashMap a (Key, Value) pair is added and the hash function is calculated using key. Where as in the HashSet hash function is calculated using the value itself. Note that in HashSet we have add(E e) method which takes just the element to be added as parameter.