Here you can find the source of putAllRecursively(Map
@SuppressWarnings("unchecked") public static void putAllRecursively(Map<String, Object> destination, Map<String, Object> source)
//package com.java2s; //License from project: Open Source License import java.util.Map; public class Main { /**//from w ww . ja v a 2s. c o m * 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); } } } }