MCPcopy Create free account
hub / github.com/antlr/codebuff / copyEntry

Method copyEntry

output/java_guava/1.4.18/LocalCache.java:2223–2238  ·  view source on GitHub ↗

Copies original into a new entry chained to newNext. Returns the new entry, or null if original was already garbage collected.

(ReferenceEntry<K, V> original, ReferenceEntry<K, V> newNext)

Source from the content-addressed store, hash-verified

2221 */
2222
2223 @GuardedBy("this")
2224 ReferenceEntry<K, V> copyEntry(ReferenceEntry<K, V> original, ReferenceEntry<K, V> newNext) {
2225 if (original.getKey() == null) {
2226 // key collected
2227 return null;
2228 }
2229 ValueReference<K, V> valueReference = original.getValueReference();
2230 V value = valueReference.get();
2231 if ((value == null) && valueReference.isActive()) {
2232 // value collected
2233 return null;
2234 }
2235 ReferenceEntry<K, V> newEntry = map.entryFactory.copyEntry(this, original, newNext);
2236 newEntry.setValueReference(valueReference.copyFor(this.valueReferenceQueue, value, newEntry));
2237 return newEntry;
2238 }
2239
2240 /**
2241 * Sets a new value of an entry. Adds newly created entries at the end of the access queue.

Callers 2

expandMethod · 0.95
removeEntryFromChainMethod · 0.95

Calls 7

getKeyMethod · 0.65
getValueReferenceMethod · 0.65
getMethod · 0.65
isActiveMethod · 0.65
setValueReferenceMethod · 0.65
copyForMethod · 0.65
copyEntryMethod · 0.45

Tested by

no test coverage detected