Java Utililty Methods ConcurrentMap

List of utility methods to do ConcurrentMap

Description

The list of methods to do ConcurrentMap are organized into topic(s).

Method

ClassgetTypeFromKind(String kind)
Obtain the class for the specified kind.
return KIND_TO_TYPE.get(kind);
booleanis(Class clazz, Collection> clazzes, ConcurrentMap, Boolean> cache)
Checks is a class is assignable to a class in the give collection.
if (clazz == null) {
    throw new IllegalArgumentException("clazz is null");
if (clazzes == null) {
    throw new IllegalArgumentException("clazzes is null");
if (cache == null) {
    throw new IllegalArgumentException("cache is null");
...
booleanisClassClass(Class clazz)
is Class Class
return is(clazz, CLASS_CLASSES, IS_CACHE_CACHE);
VputIfAbsent(ConcurrentMap map, K key, V value)
put If Absent
V current = map.putIfAbsent(key, value);
return current != null ? current : value;
VputIfAbsent(ConcurrentMap map, K key, V value)
How putIfAbsent should work, returns the one value that actually ends up in the ConcurrentMap
final V existingValue = map.putIfAbsent(key, value);
if (existingValue == null) {
    return value;
return existingValue;
VputIfAbsent(ConcurrentMap map, K key, V value)

Puts a value in the specified ConcurrentMap if the key is not yet present.

if (map == null) {
    return null;
V result = map.putIfAbsent(key, value);
return result != null ? result : value;
VputIfAbsent(ConcurrentMap target, K key, V value)
put If Absent
V _value = target.get(key);
if (_value != null) {
    V _previous = target.putIfAbsent(key, _value);
    if (_previous != null) {
        _value = _previous;
return _value;
...
VputIfAbsent(final ConcurrentMap map, final K key, final V value)
put If Absent
V exists = map.putIfAbsent(key, value);
if (exists != null) {
    return exists;
return value;
VputIfAbsentAndGet(ConcurrentMap map, K key, V newValue)
If the specified key is not already associated with a value, associate it with the given value.
final V old = map.putIfAbsent(key, newValue);
return old != null ? old : newValue;
booleanremove(ConcurrentMap map, K key, V value)
Removes the entry for a key only if currently mapped to a given value.
return map != null && map.remove(key, value);