Lines Matching refs:key
51 public V get(K key) {
55 CacheEntry<K, V> entry = map.get(key);
60 V newVal = createObject(key);
61 // make sure key is normalized *after* the object creation
62 // so that newVal is assured to be created from a valid key.
63 key = normalizeKey(key);
64 if (key == null || newVal == null) {
65 // subclass must return non-null key/value object
69 CacheEntry<K, V> newEntry = new CacheEntry<>(key, newVal, queue);
71 entry = map.putIfAbsent(key, newEntry);
77 map.put(key, newEntry);
85 protected V put(K key, V value) {
86 CacheEntry<K, V> entry = new CacheEntry<>(key, value, queue);
87 CacheEntry<K, V> oldEntry = map.put(key, entry);
99 protected abstract V createObject(K key);
101 protected K normalizeKey(K key) {
102 return key;
106 private K key;
108 CacheEntry(K key, V value, ReferenceQueue<V> queue) {
110 this.key = key;
114 return key;