Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class Main {

    public static void main(String[] args) {
        Map<String, String> m1 = new LinkedHashMap<String, String>();
        m1.put("1", "One");
        m1.put("3", "Three");

        Map<String, String> m2 = new LinkedHashMap<String, String>();
        m2.put("2", "Two");
        m2.put("4", "Four");

        List<String> list = new ArrayList<String>();
        list.addAll(m1.keySet());
        list.addAll(m2.keySet());
        for (String s : list) {
            System.out.println(s);
        }
    }

}