Deep merges two maps

@param dst the map where elements will be merged into
@param src the map with the elements to merge
@return a deep merge of the two given maps.
547176
@SuppressWarnings("unchecked")
    public static Map deepMerge(Map dst, Map src) {
        if (dst != null && src != null) {
            for (Object key : src.keySet()) {
                if (src.get(key) instanceof Map && dst.get(key) instanceof Map) {
                    Map originalChild = (Map)dst.get(key);
                    Map newChild = (Map)src.get(key);
                    dst.put(key, deepMerge(originalChild, newChild));
                } else {
                    dst.put(key, src.get(key));
                }
            }
        }

        return dst;
    }
821779
public static void fill(Mapping src, Mapping dst) {
        for (Node off : src.getOfflineNodes()) {
            dst.addOfflineNode(off);
        }
        for (VM r : src.getReadyVMs()) {
            dst.addReadyVM(r);
        }
        for (Node on : src.getOnlineNodes()) {
            dst.addOnlineNode(on);
            for (VM r : src.getRunningVMs(on)) {
                dst.addRunningVM(r, on);
            }
            for (VM s : src.getSleepingVMs(on)) {
                dst.addSleepingVM(s, on);
            }

        }
    }
1168254
public static void shiftLeft(final byte[] src, final int bits,
    final byte[] dst) {
    final int bitPart = bits % 8;
    final int bytePart = bits / 8;
    for (int i = 0; i < dst.length; i++) {
      final int a = i + bytePart;
      if (a >= 0 && src.length > a) {
        dst[i] |= (byte) ((src[a] & 0xFF) << bitPart & 0xFF);
      }
      final int b = i + bytePart + 1;
      if (b >= 0 && src.length > b) {
        dst[i] |= (byte) ((src[b] & 0xFF) >> 8 - bitPart & 0xFF);
      }
    }
  }
1189918
function mergeOne(dst, src) {
    if (src === _undefined) return dst;

    // According to specification arrays must be concatenated.
    // Also, the '.concat' creates a new array instance. Overrides the 'dst'.
    if (isArray(src)) return (isArray(dst) ? dst : []).concat(src);

    // Now deal with non plain 'src' object. 'src' overrides 'dst'
    // Note that functions are also assigned! We do not deep merge functions.
    if (!isPlainObject(src)) return src;

    var keys = objectKeys(src), i = 0, key;
    for (; i < keys[_length];) {
      key = keys[i++];

      // Do not merge properties with the '_undefined' value.
      if (src[key] !== _undefined) {
        // deep merge each property. Recursion!
        dst[key] = mergeOne(
          // Recursive calls to mergeOne() must allow only plain objects or arrays in dst
          isPlainObject(dst[key]) || isArray(src[key]) ? dst[key] : {},
          src[key]
        );
      }
    }

    return dst;
  }
960963
protected function copyDir($src, $dst) {
		$r = true;
		$dir = opendir($src);
		\Asgard\File\FileSystem::mkdir($dst);
		while(false !== ($file = readdir($dir))) {
			if(($file != '.') && ($file != '..'))
				$r = $r && $this->copy($src.'/'.$file, $dst.'/'.$file);
		}
		closedir($dir);

		if($r !== false)
			return $dst;
		return false;
	}
156966
public void addMapping( byte[] src, String dest ) throws IOException
    {
        if( src.length == 1 )
        {
        	singleByteMappings.put( Integer.valueOf( src[0] & 0xff ), dest );
        }
        else if( src.length == 2 )
        {
            int intSrc = src[0]&0xFF;
            intSrc <<= 8;
            intSrc |= (src[1]&0xFF);
            doubleByteMappings.put( Integer.valueOf( intSrc ), dest );
        }
        else
        {
            throw new IOException( "Mapping code should be 1 or two bytes and not " + src.length );
        }
    }
1213431
def gen_jcc(src, dst):
        
        return ReilBuilder.build(ReilMnemonic.JCC, src, ReilEmptyOperand(), dst)
227601
public static JSONArray copy(final JSONArray src, final boolean deep) {
        final JSONArray dest = new JSONArray();
        final int len = src.length();
        for (int i = 0; i < len; ++i) {
            final Object value = src.opt(i);
            if (deep) {
                if (value instanceof JSONObject) {
                    dest.put(copy((JSONObject) value));
                } else if (value instanceof JSONArray) {
                    dest.put(copy((JSONArray) value));
                } else {
                    dest.put(value);
                }
            } else {
                dest.put(value);
            }
        }
        return dest;
    }
868999
public static void joinScopes(Scope source, Scope dest) {
        Map<String,Symbol> src = source.ensureSymbolTable();
        Map<String,Symbol> dst = dest.ensureSymbolTable();
        if (!Collections.disjoint(src.keySet(), dst.keySet())) {
            codeBug();
        }
        for (Map.Entry<String, Symbol> entry: src.entrySet()) {
            Symbol sym = entry.getValue();
            sym.setContainingTable(dest);
            dst.put(entry.getKey(), sym);
        }
    }
295203
func Merge(dst, src Message) {
	if m, ok := dst.(Merger); ok {
		m.Merge(src)
		return
	}

	in := reflect.ValueOf(src)
	out := reflect.ValueOf(dst)
	if out.IsNil() {
		panic("proto: nil destination")
	}
	if in.Type() != out.Type() {
		panic(fmt.Sprintf("proto.Merge(%T, %T) type mismatch", dst, src))
	}
	if in.IsNil() {
		return // Merge from nil src is a noop
	}
	if m, ok := dst.(generatedMerger); ok {
		m.XXX_Merge(src)
		return
	}
	mergeStruct(out.Elem(), in.Elem())
}
1308573
function merge(src1, src2) {
    var merged = {};
    extend(merged, src1);
    extend(merged, src2);
    return merged;
}
463962
function( src, dst ){
    this._dat[ 0|BLEND_FUNC_C_SRC ] = src;
    this._dat[ 0|BLEND_FUNC_C_DST ] = dst;
    this._set = this._set & ~BLEND_FUNC_A_SET | (~~BLEND_FUNC_SET);
    return this;
  }
1203608
public static Object[] deepBox(Class<?> resultType, final Object src) {
        Class<?> compType = resultType.getComponentType();
        if (compType.isArray()) {
            final Object[] src2 = (Object[]) src;
            final Object[] result = (Object[]) newArray(compType, src2.length);
            for (int i = 0; i < src2.length; i++) {
                result[i] = deepBox(compType, src2[i]);
            }
            return result;
        } else {
            return boxAll(compType, src, 0, -1);
        }
    }
1176445
public static long copyStream(File dst, InputStream src) throws IOException {
		long copied;

		try (FileOutputStream dstStream = new FileOutputStream(dst)) {
			copied = copyStream(dstStream, src);
		}
		return copied;
	}
196644
public static void union (IRectangle src1, IRectangle src2, Rectangle dst) {
        float x1 = Math.min(src1.minX(), src2.minX());
        float y1 = Math.min(src1.minY(), src2.minY());
        float x2 = Math.max(src1.maxX(), src2.maxX());
        float y2 = Math.max(src1.maxY(), src2.maxY());
        dst.setBounds(x1, y1, x2 - x1, y2 - y1);
    }
764053
public MultiMap merge(MultiMap multiMap)
    {
        MultiMap result = new MultiMap();
        result.map.putAll(this.map);
        result.map.putAll(multiMap.map);
        return result;
    }
891048
static public byte[] expandByteArray(byte[] src, byte[] dst) {
        int srcLength = (null != src) ? src.length : 0;
        int dstLength = (null != dst) ? dst.length : 0;
        return expandByteArray(src, dst, 0, srcLength, 0, dstLength);
    }