i'm having 2 string array,
str1[] = {"a","b","aa","c"}
and
str2[] = {"aa","a","b","c","d"}
how can i compare and remove value if exist in both string[], expected result, str3[]= {"d"}
thanks in advance
i'm having 2 string array,
and
how can i compare and remove value if exist in both string[], expected result, str3[]= {"d"} thanks in advance |
|||||||||
|
ts1 will have "d" inside it after these operations.
|
|||
|
Convert the arrays to a list and add them to a set which will automatically remove duplicates. Use the toArray() method of Set interface to get the elements as an Array.
|
|||
|