0

Sets contain only unique values?

In this question I was confused. Maybe it could be not 'values' but 'keys'?

29th Jul 2016, 9:23 AM
Владимир Бурцев
Владимир Бурцев - avatar
4 Antworten
+ 4
I think we use key to get value from Map. But Set contains only values, so it does not need key.
29th Jul 2016, 9:32 AM
WPimpong
WPimpong - avatar
+ 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.
29th Jul 2016, 5:29 PM
Zia
Zia - avatar
0
In normal sets values are the same if equals () returns true and in hashsets if the hashcode is the same, I think
31st Jul 2016, 6:36 AM
No One
No One - avatar
0
hashset is the implementation of set. and every hashset element is associated with unique hashcode
23rd Aug 2016, 6:54 AM
Hitesh Wedwani