Here you can find the source of merge(Map
public static Map<String, Object> merge(Map<String, Object> first, Map<String, Object> second)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static Map<String, Object> merge(Map<String, Object> first, Map<String, Object> second) { if (second == null || second.isEmpty()) return first; if (first == null || first.isEmpty()) return second; Map<String, Object> combined = new HashMap<>(first); combined.putAll(second);//from w w w.j a va 2s. com return combined; } }