Java, Spring, Microservices, Interview, Coding.
elements are retrieved from HashSet in Java? In HashSet there is no get method as provided in Map or List. In HashSet iterator is there which will iterate through the values of the Set. Internally it will call the keyset of the HashMap, as values are stored as keys in the HashMap so what we’ll get