Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: LGPL 

import java.util.Map;

public class Main {
    /**
     * 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));
    }
}