Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;

public class Main {
    public static void main(String[] argv) throws Exception {

        Set<String> set = new LinkedHashSet<String>();

        // Add some elements
        set.add("1");
        set.add("2");
        set.add("3");
        set.add("2");

        // List the elements
        for (Iterator it = set.iterator(); it.hasNext();) {
            Object o = it.next();
        }
    }
}