how to remove duplicates string from Arraylist in android ..try this code
ArrayList<String> list = new ArrayList<String>()
HashSet<String> pure = new LinkedHashSet<String>();
HashSet<String> dup = new LinkedHashSet<String>();
boolean b = false;
list.add("kaushik");
list.add("kaushik");
list.add("how");
list.add("you");
list.add("find");
list.add("find");
for(Iterator iterator= list.iterator();iterator.hasNext();)
{
String value = (String)iterator.next();
System.out.println(value);
dup.add(value);
else
pure .add(value);
}
System.out.println(pure );
System.out.println(dup);
0 comments