Java Map Copy copyValue(Map source, Map target, K key)

Here you can find the source of copyValue(Map source, Map target, K key)

Description

Copy value.

License

LGPL

Parameter

Parameter Description
K the key type
V the value type
source the source
target the target
key the key

Declaration

public static <K, V> void copyValue(Map<K, V> source, Map<K, V> target, K key) 

Method Source Code

//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));
    }
}

Related

  1. copyParameters(Map parameters)
  2. copyPropertiesToMap(Properties source, Map target)
  3. copySafelyToObjectToObjectMap(java.util.Map map)
  4. copyStringMap(Map initParams)
  5. copyUntilFull(final Map source, final Map dest1, Map overflow, final int dest1Capacity)
  6. copyValueIfExist(Map source, K sourceKey, Map target, K targetKey)
  7. copyValueIfExist(Map source, Map target, K key)
  8. deepCopy(Map map)
  9. deepCopy(Map> context)