Here you can find the source of putIfAbsent(ConcurrentHashMap
Parameter | Description |
---|---|
col | a parameter |
key | a parameter |
val | a parameter |
public static <K, V> V putIfAbsent(ConcurrentHashMap<K, V> col, K key, V val)
//package com.java2s; //License from project: Open Source License import java.util.concurrent.ConcurrentHashMap; public class Main { /***//from ww w . ja va 2 s . c o m * * @param col * @param key * @param val * @return */ public static <K, V> V putIfAbsent(ConcurrentHashMap<K, V> col, K key, V val) { if (col.containsKey(key) == false) { col.put(key, val); } return col.get(key); } }