ittimepass.com
Write a program in java to demonstrate remove duplication from ArrayList to TreeSet? ⋆ IT TIME PASS
import java.util.*; public class ListAdd { public static void main(String arg[]) { Scanner in=new Scanner(System.in); ArrayList ls=new ArrayList(); TreeSet set=new TreeSet(); ls.add("Vikrant"); ls.add("Manish"); ls.add("Suraj"); ls.add(3,"Amit"); ls.add("Manish"); ls.add("Kanir"); set.addAll(ls); System.out.println("Total Number of Elements is "+ls.size()); Iterator l=ls.iterator(); while(l.hasNext()) System.out.println(l.next()); …