com.sigopt.net.MapHelper Maven / Gradle / Ivy
package com.sigopt.net;
import java.util.HashMap;
import java.util.Map;
class MapHelper {
// toMerge will overwrite map values.
public static Map merge(Map map, Map toMerge) {
Map ret = new HashMap();
ret.putAll(ensure(map));
ret.putAll(ensure(toMerge));
return ret;
}
public static Map ensure(Map map) {
if(map == null) {
return new HashMap();
}
return map;
}
}