@Override public boolean replace(final K key, final V expectedValue, final V updatedValue) { if (_parent != null && !_parent.replace(key, expectedValue, updatedValue)) { return false; } _cache.put(key, updatedValue); return true; }
/** * Gets a value indicating whether a cached value exists for the given key. */ public boolean contains(final K key) { return get(key) != null; }
@Override public V cache(final K key, final V value) { V cachedValue = _cache.get(key); if (cachedValue != null) { return cachedValue; } if (_parent != null) { cachedValue = _parent.cache(key, value); } else { cachedValue = value; } _cache.put(key, cachedValue); return cachedValue; }
/** * Gets a value indicating whether a cached value exists for the given key. */ public boolean contains(final K key) { return get(key) != null; }
@Override public V cache(final K key, final V value) { V cachedValue = _cache.get(key); if (cachedValue != null) { return cachedValue; } if (_parent != null) { cachedValue = _parent.cache(key, value); } else { cachedValue = value; } _cache.put(key, cachedValue); return cachedValue; }
/** * Gets a value indicating whether a cached value exists for the given key. */ public boolean contains(final K key) { return get(key) != null; }
@Override public boolean replace(final K key, final V expectedValue, final V updatedValue) { if (_parent != null && !_parent.replace(key, expectedValue, updatedValue)) { return false; } _cache.put(key, updatedValue); return true; }
@Override public V cache(final K key, final V value) { V cachedValue = _cache.get(key); if (cachedValue != null) { return cachedValue; } if (_parent != null) { cachedValue = _parent.cache(key, value); } else { cachedValue = value; } _cache.put(key, cachedValue); return cachedValue; }
/** * Gets a value indicating whether the cached value matches the given value * for a specified key. */ public boolean contains(final K key, final V value) { final V cachedValue = get(key); return cachedValue != null && cachedValue.equals(value); }
@Override public boolean replace(final K key, final V expectedValue, final V updatedValue) { if (_parent != null && !_parent.replace(key, expectedValue, updatedValue)) { return false; } _cache.put(key, updatedValue); return true; }
public static Object fromElementOrPrimitiveType(final Class<?> elementType) { VerifyArgument.notNull(elementType, "elementType"); final Object cachedArray = THREAD_LOCAL_CACHE.get(elementType); if (cachedArray != null) { return cachedArray; } return THREAD_LOCAL_CACHE.cache(elementType, Array.newInstance(elementType, 0)); }
/** * Gets a value indicating whether the cached value matches the given value * for a specified key. */ public boolean contains(final K key, final V value) { final V cachedValue = get(key); return cachedValue != null && cachedValue.equals(value); }
@SuppressWarnings("unchecked") public static <T> T[] fromElementType(final Class<T> elementType) { VerifyArgument.notNull(elementType, "elementType"); final T[] cachedArray = (T[])THREAD_LOCAL_CACHE.get(elementType); if (cachedArray != null) { return cachedArray; } return (T[])THREAD_LOCAL_CACHE.cache(elementType, Array.newInstance(elementType, 0)); }
/** * Gets a value indicating whether the cached value matches the given value * for a specified key. */ public boolean contains(final K key, final V value) { final V cachedValue = get(key); return cachedValue != null && cachedValue.equals(value); }
public static Object fromElementOrPrimitiveType(final Class<?> elementType) { VerifyArgument.notNull(elementType, "elementType"); final Object cachedArray = THREAD_LOCAL_CACHE.get(elementType); if (cachedArray != null) { return cachedArray; } return THREAD_LOCAL_CACHE.cache(elementType, Array.newInstance(elementType, 0)); }
@Override public V get(final K key) { V cachedValue = _cache.get(key); if (cachedValue != null) { return cachedValue; } if (_parent != null) { cachedValue = _parent.get(key); if (cachedValue != null) { _cache.put(key, cachedValue); } } return cachedValue; } }
@SuppressWarnings("unchecked") public static <T> T[] fromElementType(final Class<T> elementType) { VerifyArgument.notNull(elementType, "elementType"); final T[] cachedArray = (T[])THREAD_LOCAL_CACHE.get(elementType); if (cachedArray != null) { return cachedArray; } return (T[])THREAD_LOCAL_CACHE.cache(elementType, Array.newInstance(elementType, 0)); }