Here you can find the source of putAllIfNew(Map
Parameter | Description |
---|---|
dest | a parameter |
source | a parameter |
public static Map<String, Object> putAllIfNew(Map<String, Object> dest, Map<String, Object> source)
//package com.java2s; import java.util.Map; public class Main { /**//from ww w.j a va 2 s . c om * Same as putall, except if the property already exists in the dest map, don't move it. * TODO Convert this to generics. * @param dest * @param source * @return */ public static Map<String, Object> putAllIfNew(Map<String, Object> dest, Map<String, Object> source) { if (dest == null) return source; if (source == null) return dest; for (String key : source.keySet()) { if (dest.get(key) == null) dest.put(key, source.get(key)); } return dest; } }