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

Comparing jsr166/src/jdk8/java/util/concurrent/ConcurrentSkipListMap.java (file contents):
Revision 1.2 by jsr166, Wed Apr 27 19:19:34 2016 UTC vs.
Revision 1.3 by jsr166, Thu May 5 16:17:51 2016 UTC

# Line 347 | Line 347 | public class ConcurrentSkipListMap<K,V>
347  
348      /** Lazily initialized key set */
349      private transient KeySet<K,V> keySet;
350    /** Lazily initialized entry set */
351    private transient EntrySet<K,V> entrySet;
350      /** Lazily initialized values collection */
351      private transient Values<K,V> values;
352 +    /** Lazily initialized entry set */
353 +    private transient EntrySet<K,V> entrySet;
354      /** Lazily initialized descending key set */
355 <    private transient ConcurrentNavigableMap<K,V> descendingMap;
355 >    private transient SubMap<K,V> descendingMap;
356  
357      /**
358       * Initializes or resets state. Needed by constructors, clone,
# Line 1798 | Line 1798 | public class ConcurrentSkipListMap<K,V>
1798       * @return a navigable set view of the keys in this map
1799       */
1800      public NavigableSet<K> keySet() {
1801 <        KeySet<K,V> ks = keySet;
1802 <        return (ks != null) ? ks : (keySet = new KeySet<>(this));
1801 >        KeySet<K,V> ks;
1802 >        if ((ks = keySet) != null) return ks;
1803 >        return keySet = new KeySet<>(this);
1804      }
1805  
1806      public NavigableSet<K> navigableKeySet() {
1807 <        KeySet<K,V> ks = keySet;
1808 <        return (ks != null) ? ks : (keySet = new KeySet<>(this));
1807 >        KeySet<K,V> ks;
1808 >        if ((ks = keySet) != null) return ks;
1809 >        return keySet = new KeySet<>(this);
1810      }
1811  
1812      /**
# Line 1827 | Line 1829 | public class ConcurrentSkipListMap<K,V>
1829       * <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
1830       */
1831      public Collection<V> values() {
1832 <        Values<K,V> vs = values;
1833 <        return (vs != null) ? vs : (values = new Values<>(this));
1832 >        Values<K,V> vs;
1833 >        if ((vs = values) != null) return vs;
1834 >        return values = new Values<>(this);
1835      }
1836  
1837      /**
# Line 1859 | Line 1862 | public class ConcurrentSkipListMap<K,V>
1862       *         sorted in ascending key order
1863       */
1864      public Set<Map.Entry<K,V>> entrySet() {
1865 <        EntrySet<K,V> es = entrySet;
1866 <        return (es != null) ? es : (entrySet = new EntrySet<K,V>(this));
1865 >        EntrySet<K,V> es;
1866 >        if ((es = entrySet) != null) return es;
1867 >        return entrySet = new EntrySet<K,V>(this);
1868      }
1869  
1870      public ConcurrentNavigableMap<K,V> descendingMap() {
1871 <        ConcurrentNavigableMap<K,V> dm = descendingMap;
1872 <        return (dm != null) ? dm : (descendingMap = new SubMap<K,V>
1873 <                                    (this, null, false, null, false, true));
1871 >        ConcurrentNavigableMap<K,V> dm;
1872 >        if ((dm = descendingMap) != null) return dm;
1873 >        return descendingMap =
1874 >            new SubMap<K,V>(this, null, false, null, false, true);
1875      }
1876  
1877      public NavigableSet<K> descendingKeySet() {
# Line 2553 | Line 2558 | public class ConcurrentSkipListMap<K,V>
2558  
2559          // Lazily initialized view holders
2560          private transient KeySet<K,V> keySetView;
2561 <        private transient Set<Map.Entry<K,V>> entrySetView;
2562 <        private transient Collection<V> valuesView;
2561 >        private transient Values<K,V> valuesView;
2562 >        private transient EntrySet<K,V> entrySetView;
2563  
2564          /**
2565           * Creates a new submap, initializing all fields.
# Line 3020 | Line 3025 | public class ConcurrentSkipListMap<K,V>
3025          /* ---------------- Submap Views -------------- */
3026  
3027          public NavigableSet<K> keySet() {
3028 <            KeySet<K,V> ks = keySetView;
3029 <            return (ks != null) ? ks : (keySetView = new KeySet<>(this));
3028 >            KeySet<K,V> ks;
3029 >            if ((ks = keySetView) != null) return ks;
3030 >            return keySetView = new KeySet<>(this);
3031          }
3032  
3033          public NavigableSet<K> navigableKeySet() {
3034 <            KeySet<K,V> ks = keySetView;
3035 <            return (ks != null) ? ks : (keySetView = new KeySet<>(this));
3034 >            KeySet<K,V> ks;
3035 >            if ((ks = keySetView) != null) return ks;
3036 >            return keySetView = new KeySet<>(this);
3037          }
3038  
3039          public Collection<V> values() {
3040 <            Collection<V> vs = valuesView;
3041 <            return (vs != null) ? vs : (valuesView = new Values<>(this));
3040 >            Values<K,V> vs;
3041 >            if ((vs = valuesView) != null) return vs;
3042 >            return valuesView = new Values<>(this);
3043          }
3044  
3045          public Set<Map.Entry<K,V>> entrySet() {
3046 <            Set<Map.Entry<K,V>> es = entrySetView;
3047 <            return (es != null) ? es : (entrySetView = new EntrySet<K,V>(this));
3046 >            EntrySet<K,V> es;
3047 >            if ((es = entrySetView) != null) return es;
3048 >            return entrySetView = new EntrySet<K,V>(this);
3049          }
3050  
3051          public NavigableSet<K> descendingKeySet() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines