Here you can find the source of copyValue(Map
Parameter | Description |
---|---|
K | the key type |
V | the value type |
source | the source |
target | the target |
key | the key |
public static <K, V> void copyValue(Map<K, V> source, Map<K, V> target, K key)
//package com.java2s; //License from project: LGPL import java.util.Map; public class Main { /**/*ww w .j av a 2 s.c om*/ * Copy value. * * @param <K> * the key type * @param <V> * the value type * @param source * the source * @param target * the target * @param key * the key */ public static <K, V> void copyValue(Map<K, V> source, Map<K, V> target, K key) { target.put(key, source.get(key)); } /** * Copy value. * * @param <K> * the key type * @param <V> * the value type * @param source * the source * @param sourceKey * the source key * @param target * the target * @param targetKey * the target key */ public static <K, V> void copyValue(Map<K, V> source, K sourceKey, Map<K, V> target, K targetKey) { target.put(targetKey, source.get(sourceKey)); } }