105 |
|
*/ |
106 |
|
private final Segment<K,V>[] segments; |
107 |
|
|
108 |
< |
private transient Set<K> keySet = null; |
109 |
< |
private transient Set/*<Map.Entry<K,V>>*/ entrySet = null; |
110 |
< |
private transient Collection<V> values = null; |
108 |
> |
private transient Set<K> keySet; |
109 |
> |
private transient Set/*<Map.Entry<K,V>>*/ entrySet; |
110 |
> |
private transient Collection<V> values; |
111 |
|
|
112 |
|
/* ---------------- Small Utilities -------------- */ |
113 |
|
|
155 |
|
/* ---------------- Inner Classes -------------- */ |
156 |
|
|
157 |
|
/** |
158 |
< |
* Segments are specialized versions of hash tables. This |
158 |
> |
* Segments are specialized versions of hash tables. This |
159 |
|
* subclasses from ReentrantLock opportunistically, just to |
160 |
|
* simplify some locking and avoid separate construction. |
161 |
|
**/ |
374 |
|
} |
375 |
|
setTable(newTable); |
376 |
|
} |
377 |
< |
|
377 |
> |
|
378 |
> |
/** |
379 |
> |
* Remove; match on key only if value null, else match both. |
380 |
> |
*/ |
381 |
|
V remove(Object key, int hash, Object value) { |
382 |
|
lock(); |
383 |
|
try { |
733 |
|
/** |
734 |
|
* Removes the (key, value) pair from this |
735 |
|
* table. This method does nothing if the key is not in the table, |
736 |
< |
* or if the key is associated with a different value. This method |
734 |
< |
* is needed by EntrySet. |
736 |
> |
* or if the key is associated with a different value. |
737 |
|
* |
738 |
|
* @param key the key that needs to be removed. |
739 |
|
* @param value the associated value. If the value is null, |
744 |
|
* <code>null</code>. |
745 |
|
*/ |
746 |
|
public V remove(Object key, Object value) { |
745 |
– |
if (value == null) |
746 |
– |
return null; |
747 |
|
int hash = hash(key); |
748 |
|
return segmentFor(hash).remove(key, segmentHashFor(hash), value); |
749 |
|
} |