Java Map Merge merge(Map first, Map second)

Here you can find the source of merge(Map first, Map second)

Description

merge

License

Apache License

Declaration

public static Map<String, Object> merge(Map<String, Object> first, Map<String, Object> second) 

Method Source Code

//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;
    }
}

Related

  1. merge(Map left, Map right)
  2. merge(Map map, K key, V value)
  3. merge(Map map, Map... maps)
  4. merge(Map master, Map copy)
  5. merge(Map src, Map dest)
  6. merge(Map map1, Map map2)
  7. merge(Map mapPriorityLeast, Map mapPriorityFirst)
  8. mergeAggCompStatsTopoPageSpout(Map accSpoutStats, Map spoutStats)
  9. mergeBootArgumentsIntoMap(String[] args, Map map)