hello guys i am try to eliminate all the duplicate strings from a string of array and preserve only one string of that…
assume temp[] be the string array and contains
temp[0] = "stack";
temp[1] = "overflow";
temp[2] = "stack";
temp[3] = "stack";
temp[4] = "overflow";
i need only “stack” and “overflow” in this case (it may be stored into another string array) but preserving the order as
temp2[0] = "stack";
temp2[1] = "overflow";
assume temp2 be another string array..
A
java.util.LinkedHashSetwill remove duplicates while preserving order.