Please consider the below piece of code:
HashSet hs = new HashSet(); hs.add(\"hi\"); -- (1) hs.add(\"hi\"); -- (2)
hs.size() w
hs.size()
You need to check put method in Hash map first as HashSet is backed up by HashMap