Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.LinkedHashMap;

import java.util.Map;

public class Main {
    @SafeVarargs
    public static <K, V> Map<K, V> merge(Map<K, V>... maps) {
        if (maps == null) {
            return null;
        }
        Map<K, V> result = null;
        for (Map<K, V> map : maps) {
            if (map != null) {
                if (result == null) {
                    result = new LinkedHashMap<K, V>();
                }
                result.putAll(map);
            }
        }
        return result;
    }
}