Hello,
I am using Set class to remove duplicates from an array. The order in the array is important for my work. After removing the duplicates i create another array containing the elements of the Set, but I realize that the order is really different from the first array. Does anyone know how can I have the order of the Set it was inserted first?
The code I am using:
// my is the array containing the information, which can can contain duplicates.
Set mySet = new HashSet(Arrays.asList(my));
// creating new array with the elements of mySet
String [] result = (String[])(mySet.toArray(new String[mySet.size()]));
Thank you in advance,
Mokita