Here you can find the source of copy(Map, ?> src, Map, ?> propertyRef)
public static Map<?, ?> copy(Map<?, ?> src, Map<?, ?> propertyRef)
//package com.java2s; //License from project: Apache License import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Set; public class Main { public static Map<?, ?> copy(Map<?, ?> src, Map<?, ?> propertyRef) { Map<Object, Object> dst = new HashMap<Object, Object>(); Set<?> entrySet = src.entrySet(); for (Object object : entrySet) { if (object != null && object instanceof Entry<?, ?>) { Entry<?, ?> entry = (Entry<?, ?>) object; Object key = entry.getKey(); Object value = entry.getValue(); if (key != null) { Object refKey = propertyRef.get(key); if (refKey != null) { dst.put(refKey, value); }/*from w w w . j a va 2s . co m*/ } } } return dst; } }