Lines Matching defs:size
35 * <p>By default, the cache size is measured in the number of entries. Override
36 * {@link #sizeOf} to size the cache in different units. For example, this cache
66 private int size;
89 * Sets the size of the cache.
91 * @param maxSize The new maximum size.
145 size += safeSizeOf(key, createdValue);
172 size += safeSizeOf(key, value);
175 size -= safeSizeOf(key, previous);
189 * below the requested size.
191 * @param maxSize the maximum size of the cache before returning. May be -1
199 if (size < 0 || (map.isEmpty() && size != 0)) {
204 if (size <= maxSize) {
216 size -= safeSizeOf(key, value);
238 size -= safeSizeOf(key, previous);
288 throw new IllegalStateException("Negative size: " + key + "=" + value);
294 * Returns the size of the entry for {@code key} and {@code value} in
295 * user-defined units. The default implementation returns 1 so that size
296 * is the number of entries and max size is the maximum number of entries.
298 * <p>An entry's size must not change while it is in the cache.
316 public synchronized final int size() {
317 return size;