2599 |
|
|
2600 |
|
} |
2601 |
|
|
2602 |
– |
/** |
2603 |
– |
* Custom Entry class used by Entry iterators that relays |
2604 |
– |
* setValue changes to the underlying map. For explanation, |
2605 |
– |
* see similar construction in ConcurrentHashMap. |
2606 |
– |
*/ |
2607 |
– |
final class WriteThroughEntry extends AbstractMap.SimpleEntry<K,V> { |
2608 |
– |
WriteThroughEntry(K k, Object v) { |
2609 |
– |
super(k, (V)v); |
2610 |
– |
} |
2611 |
– |
public V setValue(V value) { |
2612 |
– |
if (value == null) throw new NullPointerException(); |
2613 |
– |
V v = super.setValue(value); |
2614 |
– |
ConcurrentSkipListMap.this.put(getKey(), value); |
2615 |
– |
return v; |
2616 |
– |
} |
2617 |
– |
} |
2618 |
– |
|
2602 |
|
final class ValueIterator extends Iter implements Iterator<V> { |
2603 |
|
ValueIterator() { |
2604 |
|
initAscending(); |
2680 |
|
} |
2681 |
|
public Map.Entry<K,V> next() { |
2682 |
|
Node<K,V> n = next; |
2683 |
+ |
V v = (V)nextValue; |
2684 |
|
ascend(); |
2685 |
< |
return new WriteThroughEntry(n.key, n.value); |
2685 |
> |
return new AbstractMap.SimpleImmutableEntry<K,V>(n.key, v); |
2686 |
|
} |
2687 |
|
} |
2688 |
|
|
2695 |
|
|
2696 |
|
public Map.Entry<K,V> next() { |
2697 |
|
Node<K,V> n = next; |
2698 |
+ |
V v = (V)nextValue; |
2699 |
|
ascend(fence); |
2700 |
< |
return new WriteThroughEntry(n.key, n.value); |
2700 |
> |
return new AbstractMap.SimpleImmutableEntry<K,V>(n.key, v); |
2701 |
|
} |
2702 |
|
} |
2703 |
|
|
2707 |
|
} |
2708 |
|
public Map.Entry<K,V> next() { |
2709 |
|
Node<K,V> n = next; |
2710 |
+ |
V v = (V)nextValue; |
2711 |
|
descend(); |
2712 |
< |
return new WriteThroughEntry(n.key, n.value); |
2712 |
> |
return new AbstractMap.SimpleImmutableEntry<K,V>(n.key, v); |
2713 |
|
} |
2714 |
|
} |
2715 |
|
|
2722 |
|
|
2723 |
|
public Map.Entry<K,V> next() { |
2724 |
|
Node<K,V> n = next; |
2725 |
+ |
V v = (V)nextValue; |
2726 |
|
descend(least); |
2727 |
< |
return new WriteThroughEntry(n.key, n.value); |
2727 |
> |
return new AbstractMap.SimpleImmutableEntry<K,V>(n.key, v); |
2728 |
|
} |
2729 |
|
} |
2730 |
|
|