Java Map Add addToMap(Map map, K key, V value)

Here you can find the source of addToMap(Map map, K key, V value)

Description

add To Map

License

Open Source License

Declaration

public static <K, V> Map<K, V> addToMap(Map<K, V> map, K key, V value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.HashMap;

import java.util.Map;

public class Main {
    public static <K, V> Map<K, V> addToMap(Map<K, V> map, K key, V value) {
        if (key == null)
            return map;
        if (map == null)
            map = new HashMap<K, V>();
        map.put(key, value);// w  w  w . j a v a 2  s. c  om
        return map;
    }
}

Related

  1. addToListMap(Map> map, T key, V val)
  2. addToListMap(Map> map, TKey key, TValue value)
  3. addToMap(Map map, int initialKey, T value)
  4. addToMap(Map data, K key, T value, Class clz)
  5. addToMap(Map map, K key, V value)
  6. addToMap(Map> cfs, String[] qualSplits, String[] splitQual)
  7. addToMap(Map dest, Map src)
  8. addToMap(Map aMap, T aKey, Float aValue)
  9. addToMap(Map map, T item)