Java Map Put put(ThreadLocal> threadLocal, Object key, String value)

Here you can find the source of put(ThreadLocal> threadLocal, Object key, String value)

Description

put

License

Open Source License

Declaration

private static void put(ThreadLocal<Map<Object, String>> threadLocal,
            Object key, String value) 

Method Source Code

//package com.java2s;
import java.util.HashMap;
import java.util.Map;

public class Main {
    private static void put(ThreadLocal<Map<Object, String>> threadLocal,
            Object key, String value) {
        Map<Object, String> map = threadLocal.get();

        if (map == null) {
            map = new HashMap<>();
        }//  w  w w .  j a v  a2 s  . c  o m

        if (!map.containsKey(key)) {
            map.put(key, value);

            threadLocal.set(map);
        }
    }
}

Related

  1. put(Map aMap, K aKey, V aValue)
  2. put(Map map, K key, V value)
  3. put(Map map, K key, V value)
  4. put(Map map, String key, Object value)
  5. put(Map structure, String name, Object object)
  6. put2DayOfWeekMaps(int pDayOfWeek, String pDayName)
  7. putAbsent(Map dest, Map src)
  8. putAll(final Map dst, final Map src)
  9. putAll(M map, Iterable> values)