Java tutorial
//package com.java2s; //License from project: LGPL import java.util.Map; import java.util.Set; public class Main { /** * Copy values. * * @param <K> * the key type * @param <V> * the value type * @param source * the source * @param target * the target * @param keys * the keys */ public static <K, V> void copyValues(Map<K, V> source, Map<K, V> target, Set<K> keys) { for (K key : keys) { target.put(key, source.get(key)); } } }