import java.util.*;

public class RemoveDoubles {
    public static void main(String[] args) {
        // illustrating that a set filters doubles
        ArrayList list = new ArrayList();
        list.add("a");
        list.add("a");
        list.add("c");

        System.out.println("list.size(): " + list.size());
        System.out.println("list: " + list);

        HashSet set = new HashSet(list);
        System.out.println("set.size(): " + set.size());
        System.out.println("set: " + set);


        list = new ArrayList(set);
        System.out.println("list: " + list);
    }
}

/*
list.size(): 3
list: [a, a, c]
set.size(): 2
set: [a, c]
list: [a, c]
*/