0
Sets contain only unique values?
In this question I was confused. Maybe it could be not 'values' but 'keys'?
4 odpowiedzi
+ 4
I think we use key to get value from Map.
But Set contains only values, so it does not need key.
+ 2
sets contain only unique values. we can't have duplicate values in a set. it's just same as sets in mathematics. it refers to values or rather data we enter, not the key.
0
In normal sets values are the same if equals () returns true and in hashsets if the hashcode is the same, I think
0
hashset is the implementation of set. and every hashset element is associated with unique hashcode