/** * Clear the cache, calling {@link #entryEvicted} on each removed entry. */ public synchronized final void evictAll() { trimToSize(0); } }
/** * Caches {@code value} for {@code key}. The value is moved to the head of * the queue. * * @return the previous value mapped by {@code key}. Although that entry is * no longer cached, it has not been passed to {@link #entryEvicted}. */ public synchronized final V put(K key, V value) { if (key == null) { throw new NullPointerException("key == null"); } else if (value == null) { throw new NullPointerException("value == null"); } V previous = map.put(key, value); trimToSize(maxSize); return previous; }
/** * Returns the value for {@code key} if it exists in the cache or can be * created by {@code #create}. If a value was returned, it is moved to the * head of the queue. This returns null if a value is not cached and cannot * be created. */ public synchronized final V get(K key) { if (key == null) { throw new NullPointerException("key == null"); } V result = map.get(key); if (result != null) { return result; } result = create(key); if (result != null) { map.put(key, result); trimToSize(maxSize); } return result; }
/** * Clear the cache, calling {@link #entryEvicted} on each removed entry. */ public synchronized final void evictAll() { trimToSize(0); } }
/** * Clear the cache, calling {@link #entryEvicted} on each removed entry. */ public synchronized final void evictAll() { trimToSize(0); } }
/** * Clear the cache, calling {@link #entryEvicted} on each removed entry. */ public synchronized final void evictAll() { trimToSize(0); } }
/** * Clear the cache, calling {@link #entryEvicted} on each removed entry. */ public synchronized final void evictAll() { trimToSize(0); } }
/** * Clear the cache, calling {@link #entryEvicted} on each removed entry. */ public synchronized final void evictAll() { trimToSize(0); } }
/** * Clear the cache, calling {@link #entryEvicted} on each removed entry. */ public synchronized final void evictAll() { trimToSize(0); } }
/** * Caches {@code value} for {@code key}. The value is moved to the head of * the queue. * * @return the previous value mapped by {@code key}. Although that entry is * no longer cached, it has not been passed to {@link #entryEvicted}. */ public synchronized final V put(K key, V value) { if (key == null) { throw new NullPointerException("key == null"); } else if (value == null) { throw new NullPointerException("value == null"); } V previous = map.put(key, value); trimToSize(maxSize); return previous; }
/** * Caches {@code value} for {@code key}. The value is moved to the head of * the queue. * * @return the previous value mapped by {@code key}. Although that entry is * no longer cached, it has not been passed to {@link #entryEvicted}. */ public synchronized final V put(K key, V value) { if (key == null) { throw new NullPointerException("key == null"); } else if (value == null) { throw new NullPointerException("value == null"); } V previous = map.put(key, value); trimToSize(maxSize); return previous; }
/** * Caches {@code value} for {@code key}. The value is moved to the head of * the queue. * * @return the previous value mapped by {@code key}. Although that entry is * no longer cached, it has not been passed to {@link #entryEvicted}. */ public synchronized final V put(K key, V value) { if (key == null) { throw new NullPointerException("key == null"); } else if (value == null) { throw new NullPointerException("value == null"); } V previous = map.put(key, value); trimToSize(maxSize); return previous; }
/** * Caches {@code value} for {@code key}. The value is moved to the head of * the queue. * * @return the previous value mapped by {@code key}. Although that entry is * no longer cached, it has not been passed to {@link #entryEvicted}. */ public synchronized final V put(K key, V value) { if (key == null) { throw new NullPointerException("key == null"); } else if (value == null) { throw new NullPointerException("value == null"); } V previous = map.put(key, value); trimToSize(maxSize); return previous; }
/** * Caches {@code value} for {@code key}. The value is moved to the head of * the queue. * * @return the previous value mapped by {@code key}. Although that entry is * no longer cached, it has not been passed to {@link #entryEvicted}. */ public synchronized final V put(K key, V value) { if (key == null) { throw new NullPointerException("key == null"); } else if (value == null) { throw new NullPointerException("value == null"); } V previous = map.put(key, value); trimToSize(maxSize); return previous; }
/** * Caches {@code value} for {@code key}. The value is moved to the head of * the queue. * * @return the previous value mapped by {@code key}. Although that entry is * no longer cached, it has not been passed to {@link #entryEvicted}. */ public synchronized final V put(K key, V value) { if (key == null) { throw new NullPointerException("key == null"); } else if (value == null) { throw new NullPointerException("value == null"); } V previous = map.put(key, value); trimToSize(maxSize); return previous; }
/** * Returns the value for {@code key} if it exists in the cache or can be * created by {@code #create}. If a value was returned, it is moved to the * head of the queue. This returns null if a value is not cached and cannot * be created. */ public synchronized final V get(K key) { if (key == null) { throw new NullPointerException("key == null"); } V result = map.get(key); if (result != null) { return result; } result = create(key); if (result != null) { map.put(key, result); trimToSize(maxSize); } return result; }
/** * Returns the value for {@code key} if it exists in the cache or can be * created by {@code #create}. If a value was returned, it is moved to the * head of the queue. This returns null if a value is not cached and cannot * be created. */ public synchronized final V get(K key) { if (key == null) { throw new NullPointerException("key == null"); } V result = map.get(key); if (result != null) { return result; } result = create(key); if (result != null) { map.put(key, result); trimToSize(maxSize); } return result; }
/** * Returns the value for {@code key} if it exists in the cache or can be * created by {@code #create}. If a value was returned, it is moved to the * head of the queue. This returns null if a value is not cached and cannot * be created. */ public synchronized final V get(K key) { if (key == null) { throw new NullPointerException("key == null"); } V result = map.get(key); if (result != null) { return result; } result = create(key); if (result != null) { map.put(key, result); trimToSize(maxSize); } return result; }
/** * Returns the value for {@code key} if it exists in the cache or can be * created by {@code #create}. If a value was returned, it is moved to the * head of the queue. This returns null if a value is not cached and cannot * be created. */ public synchronized final V get(K key) { if (key == null) { throw new NullPointerException("key == null"); } V result = map.get(key); if (result != null) { return result; } result = create(key); if (result != null) { map.put(key, result); trimToSize(maxSize); } return result; }
/** * Returns the value for {@code key} if it exists in the cache or can be * created by {@code #create}. If a value was returned, it is moved to the * head of the queue. This returns null if a value is not cached and cannot * be created. */ public synchronized final V get(K key) { if (key == null) { throw new NullPointerException("key == null"); } V result = map.get(key); if (result != null) { return result; } result = create(key); if (result != null) { map.put(key, result); trimToSize(maxSize); } return result; }