Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.Map;

public class Main {
    /**
     * Puts all the values in the given source {@code Map} into the
     * destination {@code Map}, merging any {@code Map} values.
     */
    @SuppressWarnings("unchecked")
    public static void putAllRecursively(Map<String, Object> destination, Map<String, Object> source) {
        for (Map.Entry<String, Object> e : source.entrySet()) {
            String key = e.getKey();
            Object srcValue = e.getValue();
            Object dstValue = destination.get(key);
            if (srcValue instanceof Map && dstValue instanceof Map) {
                putAllRecursively((Map<String, Object>) dstValue, (Map<String, Object>) srcValue);
            } else {
                destination.put(key, srcValue);
            }
        }
    }
}