1126 |
|
* Custom Entry class used by EntryIterator.next(), that relays |
1127 |
|
* setValue changes to the underlying map. |
1128 |
|
*/ |
1129 |
< |
static final class WriteThroughEntry<K,V> |
1129 |
> |
final class WriteThroughEntry |
1130 |
|
extends AbstractMap.SimpleEntry<K,V> |
1131 |
|
{ |
1132 |
< |
private final ConcurrentHashMap<K,V> map; |
1133 |
< |
WriteThroughEntry(ConcurrentHashMap map, K k, V v) { |
1132 |
> |
WriteThroughEntry(K k, V v) { |
1133 |
|
super(k,v); |
1135 |
– |
this.map = map; |
1134 |
|
} |
1135 |
|
|
1136 |
|
/** |
1145 |
|
public V setValue(V value) { |
1146 |
|
if (value == null) throw new NullPointerException(); |
1147 |
|
V v = super.setValue(value); |
1148 |
< |
map.put(getKey(), value); |
1148 |
> |
ConcurrentHashMap.this.put(getKey(), value); |
1149 |
|
return v; |
1150 |
|
} |
1151 |
|
} |
1156 |
|
{ |
1157 |
|
public Map.Entry<K,V> next() { |
1158 |
|
HashEntry<K,V> e = super.nextEntry(); |
1159 |
< |
return new WriteThroughEntry<K,V>(ConcurrentHashMap.this, |
1162 |
< |
e.key, e.value); |
1159 |
> |
return new WriteThroughEntry(e.key, e.value); |
1160 |
|
} |
1161 |
|
} |
1162 |
|
|