Hi Guys,how to remove duplicate from this array
would you please help me on this? I have a code like this, I have to sort
it and then remove duplicate. I've already sorted it but problem removing
duplicates. would you please complete code below for me?
import java.util.*;
public class NoDuplicate {
public static void main(String[] args) {
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(54);
list.add(12);
list.add(62);
list.add(54);
list.add(12);
list.add(43);
list.add(62);
Collections.sort(list);
removeDuplicate(list);
for (int i = 0; i < list.size(); i++)
System.out.println(list.get(i));
}
**private static ArrayList<Integer> removeDuplicate(ArrayList<Integer>
list)
{
}
}**
anyone can help me write this removeDuplicate method? thanks
No comments:
Post a Comment