Java Map Put put(Map map, K key, V value)

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

Description

put

License

Apache License

Declaration

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

Method Source Code

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

import java.util.Map;

public class Main {

    public static <K, V> Map<K, V> put(Map<K, V> map, K key, V value) {
        V valueOld = map.get(key);/*ww w .  j av  a2s  . c  o  m*/
        if (valueOld == null) {
            map.put(key, value);
        }
        return map;
    }
}

Related

  1. put(Map map, Object key, int value)
  2. put(Map map, String k1, Object v1, String k2, Object v2)
  3. put(Map map, String keyValuePair)
  4. put(Map aMap, K aKey, V aValue)
  5. put(Map map, K key, V value)
  6. put(Map map, String key, Object value)
  7. put(Map structure, String name, Object object)
  8. put(ThreadLocal> threadLocal, Object key, String value)
  9. put2DayOfWeekMaps(int pDayOfWeek, String pDayName)