224 |
|
|
225 |
|
/** |
226 |
|
* A function computing a mapping from the given key to a value, |
227 |
< |
* or {@code null} if there is no mapping. |
227 |
> |
* or {@code null} if there is no mapping. |
228 |
|
*/ |
229 |
|
public static interface MappingFunction<K, V> { |
230 |
|
/** |
245 |
|
/** |
246 |
|
* A function computing a new mapping from the given key and its |
247 |
|
* current value to a new value, or {@code null} if there is |
248 |
< |
* no mapping |
248 |
> |
* no mapping. |
249 |
|
*/ |
250 |
|
public static interface RemappingFunction<K, V> { |
251 |
|
/** |
699 |
|
* |
700 |
|
* @param key possible key |
701 |
|
* @return the value associated with the key or {@code null} if |
702 |
< |
* there is no mapping. |
702 |
> |
* there is no mapping |
703 |
|
* @throws NullPointerException if the specified key is null |
704 |
|
*/ |
705 |
|
public V get(Object key) { |
1090 |
|
* @param mappingFunction the function to compute a value |
1091 |
|
* @return the current (existing or computed) value associated with |
1092 |
|
* the specified key, or {@code null} if the computation |
1093 |
< |
* returned {@code null}. |
1093 |
> |
* returned {@code null} |
1094 |
|
* @throws NullPointerException if the specified key or mappingFunction |
1095 |
< |
* is null, |
1095 |
> |
* is null |
1096 |
|
* @throws RuntimeException or Error if the mappingFunction does so, |
1097 |
< |
* in which case the mapping is left unestablished. |
1097 |
> |
* in which case the mapping is left unestablished |
1098 |
|
*/ |
1099 |
|
public V computeIfAbsent(K key, MappingFunction<? super K, ? extends V> mappingFunction) { |
1100 |
|
if (key == null || mappingFunction == null) |
1165 |
|
* @return the updated value or |
1166 |
|
* {@code null} if the computation returned {@code null} |
1167 |
|
* @throws NullPointerException if the specified key or remappingFunction |
1168 |
< |
* is null, |
1168 |
> |
* is null |
1169 |
|
* @throws RuntimeException or Error if the remappingFunction does so, |
1170 |
|
* in which case the mapping is left in its previous state |
1171 |
|
*/ |
1720 |
|
* to {@link java.lang.ref.Reference} constructors to arrange |
1721 |
|
* removal of reclaimed nodes from maps via a background thread. |
1722 |
|
* @return the reference queue associated with the background |
1723 |
< |
* cleanup thread. |
1723 |
> |
* cleanup thread |
1724 |
|
*/ |
1725 |
|
static ReferenceQueue<Object> getReclamationQueue() { |
1726 |
|
ReferenceQueue<Object> q = refQueue; |