+ 1

What happens if a set contains duplicate elements

14th Jun 2018, 7:06 AM
Saayiaravind S
Saayiaravind S - avatar
2 ответов
+ 6
Nothing will happen. It will ignore duplicate elements set.add(4); set.add(4); set.add(5); set.add(5); System.out.print(set); Output: [ 4,5]
14th Jun 2018, 12:29 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
0
Thanks a lot!
14th Jun 2018, 12:34 PM
Saayiaravind S
Saayiaravind S - avatar