Hello, I have an array, I want to remove the duplicate items then create the new array whose elements are unique.
My code is incompleted.
Please give me a hint.
Thanks
String[] authors={"a","b","c","a","b","d",....};
List authorList = new ArrayList();
for(int k = 0; k<j; k++) {
authorList.add(authors[k]);
}
Set<String> set1 = new LinkedHashSet<String>(authorList);
List list = new ArrayList();
for(String s:set1){
list.add(s);
}
String [] authorlist = new String[list.size()];//new array
for(int i = 0;i<list.size();i++) {
authorlist[i] = list.toArray();//wrong here
}
set1.clear();