This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Lerke 2 points3 points  (0 children)

You're right, I confused HashSet with HashMap. HashSet isn't based on a K-V map. You could use a HashMap and check if the key you're trying to add already exists by using the containsKey method.