Lines Matching defs:value

24  * a value is accessed, it is moved to the head of a queue. When a value is
25 * added to a full cache, the value at the end of that queue is evicted and may
33 * assume a value will always be returned, even when there's a cache miss.
41 * protected int sizeOf(String key, Bitmap value) {
42 * return value.getByteCount();
50 * cache.put(key, value);
54 * <p>This class does not allow null to be used as a key or value. A return
55 * value of null from {@link #get}, {@link #put} or {@link #remove} is
105 * Returns the value for {@code key} if it exists in the cache or can be
106 * created by {@code #create}. If a value was returned, it is moved to the
107 * head of the queue. This returns null if a value is not cached and cannot
126 * Attempt to create a value. This may take a long time, and the map
127 * may be different when create() returns. If a conflicting value was
128 * added to the map while create() was working, we leave that value in
129 * the map and release the created value.
159 * Caches {@code value} for {@code key}. The value is moved to the head of
162 * @return the previous value mapped by {@code key}.
164 public final V put(K key, V value) {
165 if (key == null || value == null) {
166 throw new NullPointerException("key == null || value == null");
172 size += safeSizeOf(key, value);
173 previous = map.put(key, value);
180 entryRemoved(false, key, previous, value);
197 V value;
214 value = toEvict.getValue();
216 size -= safeSizeOf(key, value);
220 entryRemoved(true, key, value, null);
227 * @return the previous value mapped by {@code key}.
251 * invoked when a value is evicted to make space, removed by a call to
260 * @param newValue the new value for {@code key}, if it exists. If non-null,
267 * Called after a cache miss to compute a value for the corresponding key.
268 * Returns the computed value or null if no value can be computed. The
274 * <p>If a value for {@code key} exists in the cache when this method
275 * returns, the created value will be released with {@link #entryRemoved}
278 * thread calls {@link #put} while another is creating a value for the same
285 private int safeSizeOf(K key, V value) {
286 int result = sizeOf(key, value);
288 throw new IllegalStateException("Negative size: " + key + "=" + value);
294 * Returns the size of the entry for {@code key} and {@code value} in
300 protected int sizeOf(K key, V value) {
330 * Returns the number of times {@link #get} returned a value that was
339 * value to be created.
346 * Returns the number of times {@link #create(Object)} returned a value.