ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ConcurrentSkipListMap.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/ConcurrentSkipListMap.java (file contents):
Revision 1.43 by dl, Sun Nov 20 15:38:08 2005 UTC vs.
Revision 1.44 by dl, Fri Nov 25 13:28:24 2005 UTC

# Line 2599 | Line 2599 | public class ConcurrentSkipListMap<K,V>
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();
# Line 2697 | Line 2680 | public class ConcurrentSkipListMap<K,V>
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  
# Line 2711 | Line 2695 | public class ConcurrentSkipListMap<K,V>
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  
# Line 2722 | Line 2707 | public class ConcurrentSkipListMap<K,V>
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  
# Line 2736 | Line 2722 | public class ConcurrentSkipListMap<K,V>
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  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines