List<Integer> listWithDup = new ArrayList<Integer>();
listWithDup.add(1);
listWithDup.add(2);
listWithDup.add(3);
listWithDup.add(1);
listWithDup.add(3);
List<Integer> listWithoutDup = new ArrayList<Integer>(new HashSet<Integer>(listWithDup));
System.out.println("list with dup:"+ listWithDup);
System.out.println("list without dup:"+ listWithoutDup);
listWithDup.add(1);
listWithDup.add(2);
listWithDup.add(3);
listWithDup.add(1);
listWithDup.add(3);
List<Integer> listWithoutDup = new ArrayList<Integer>(new HashSet<Integer>(listWithDup));
System.out.println("list with dup:"+ listWithDup);
System.out.println("list without dup:"+ listWithoutDup);