Im trying to convert a string array with duplicates to string array without duplicates by using hashSet like below.
String[] d = new HashSet<String>(Arrays.asList(duplicateList)).toArray(new String[0]);
duplicateList = AD,AD,AD,AD,AD,AD,AD,AD,AD,AD,CP,RR,RR,RR,RR,RR,RR,,,,,,,,,,,
When I print d its still the same. Am i missing something?
Note: I do not want to loop through and use contains or equals.
System.out.println(Arrays.toString(d));duplicateListan array of those 2-letter strings? Or is it a large string that contains a comma-separated list?splitas in the asnwer below, for instance