Java examples for java.util:Map Entry
put to ConcurrentMap If Absent
//package com.java2s; import java.util.concurrent.ConcurrentMap; public class Main { public static <K, V> V putIfAbsent(final ConcurrentMap<K, V> map, final K key, final V value) { final V exists = map.putIfAbsent(key, value); if (exists != null) { return exists; }/*from w w w .ja va2 s.c o m*/ return value; } }