HashSet
Learn HashSet (Hashing, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
What is a HashSet? A HashSet stores unique elements with average O(1) add , contains , and remove . Internally, it's literally backed by a HashMap where every element is stored as a KEY with a dummy constant value - so everything true about HashMap's hashing behavior applies here too.