1.

How Does Hashset Internally Works In Java?

Answer»

HASHSET internally uses HashMap to store it's ELEMENTS. But it differs from HashMap on two points.

  • HashSet only stores unique VALUES i.E. no duplicates are allowed.
  • In HashSet we have add(E e) METHOD which takes just the element to be added as parameter not the (key, value) pair.

HashSet internally uses HashMap to store it's elements. But it differs from HashMap on two points.



Discussion

No Comment Found