Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

public class Main {
    public static void main(String[] argv) {
        List<String> arrayList1 = new ArrayList<String>();

        arrayList1.add("A");
        arrayList1.add("A");
        arrayList1.add("B");
        arrayList1.add("B");
        arrayList1.add("B");
        arrayList1.add("C");

        HashSet<String> hashSet = new HashSet<String>(arrayList1);

        List<String> arrayList2 = new ArrayList<String>(hashSet);

        for (Object item : arrayList2)
            System.out.println(item);
    }
}