MCPcopy Index your code
hub / github.com/wyouflf/xUtils3 / put

Method put

xutils/src/main/java/org/xutils/cache/LruCache.java:134–155  ·  view source on GitHub ↗

Caches value for key. The value is moved to the head of the queue. @return the previous value mapped by key.

(K key, V value)

Source from the content-addressed store, hash-verified

132 * @return the previous value mapped by {@code key}.
133 */
134 public final V put(K key, V value) {
135 if (key == null || value == null) {
136 throw new NullPointerException("key == null || value == null");
137 }
138
139 V previous;
140 synchronized (this) {
141 putCount++;
142 size += safeSizeOf(key, value);
143 previous = map.put(key, value);
144 if (previous != null) {
145 size -= safeSizeOf(key, previous);
146 }
147 }
148
149 if (previous != null) {
150 entryRemoved(false, key, previous, value);
151 }
152
153 trimToSize(maxSize);
154 return previous;
155 }
156
157 /**
158 * Remove the eldest entries until the total of remaining entries is at or

Callers 15

getMethod · 0.45
doBindMethod · 0.45
doLoadRequestMethod · 0.45
prepareMethod · 0.45
checkDownloadTaskMethod · 0.45
parseJSONObjectMethod · 0.45
onParseKVMethod · 0.45
params2JsonMethod · 0.45
toJSONStringMethod · 0.45
registerRequestClassMethod · 0.45
sendRequestMethod · 0.45
saveCacheInternalMethod · 0.45

Calls 3

safeSizeOfMethod · 0.95
entryRemovedMethod · 0.95
trimToSizeMethod · 0.95

Tested by

no test coverage detected