How to get the union of two string list or remove duplicates | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to get the union of two string list or remove duplicates

Please I need help with adding string list without duplicates. Example is given below. String s = "633,1985,4088,5476,9806,10138,10197,10533,10558,10710,11614,12163,12350,12548,12573,12577,12578,13689,13699,15796,20250"; String s2 = "5476,10558,10710,11614,12350,12548,12573,12577,12578"; I need to get the union. I've been trying to get the union

21st Oct 2017, 10:45 PM
Osahon Terry Ewere
Osahon Terry Ewere - avatar
2 Answers
0
.split into Arrays both strings. Add all to a HashSet<String> Call toString if you want a String back.
22nd Oct 2017, 3:33 AM
1of3
1of3 - avatar
0
Thanks.
22nd Oct 2017, 3:37 AM
Osahon Terry Ewere
Osahon Terry Ewere - avatar