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.109 by dl, Mon Mar 18 12:40:30 2013 UTC vs.
Revision 1.110 by jsr166, Mon Mar 18 18:34:07 2013 UTC

# Line 1974 | Line 1974 | public class ConcurrentSkipListMap<K,V>
1974       *         or the mappingFunction is null
1975       * @since 1.8
1976       */
1977 <    public V computeIfAbsent(K key,
1977 >    public V computeIfAbsent(K key,
1978                               Function<? super K, ? extends V> mappingFunction) {
1979 <        if (key == null || mappingFunction == null)
1980 <            throw new NullPointerException();
1979 >        if (key == null || mappingFunction == null)
1980 >            throw new NullPointerException();
1981          Comparator<? super K> cmp;
1982 <        V v, p, r;
1983 <        if ((cmp = comparator) == null) {
1984 <            if ((v = doGet(key)) == null &&
1985 <                (r = mappingFunction.apply(key)) != null)
1986 <                v = (p = doPut(key, r, true)) == null ? r : p;
1987 <        }
1988 <        else {
1989 <            if ((v = doGetCmp(cmp, key)) == null &&
1990 <                (r = mappingFunction.apply(key)) != null)
1991 <                v = (p = doPutCmp(cmp, key, r, true)) == null ? r : p;
1992 <        }
1982 >        V v, p, r;
1983 >        if ((cmp = comparator) == null) {
1984 >            if ((v = doGet(key)) == null &&
1985 >                (r = mappingFunction.apply(key)) != null)
1986 >                v = (p = doPut(key, r, true)) == null ? r : p;
1987 >        }
1988 >        else {
1989 >            if ((v = doGetCmp(cmp, key)) == null &&
1990 >                (r = mappingFunction.apply(key)) != null)
1991 >                v = (p = doPutCmp(cmp, key, r, true)) == null ? r : p;
1992 >        }
1993          return v;
1994      }
1995  
# Line 2006 | Line 2006 | public class ConcurrentSkipListMap<K,V>
2006       *         or the remappingFunction is null
2007       * @since 1.8
2008       */
2009 <    public V computeIfPresent(K key,
2009 >    public V computeIfPresent(K key,
2010                                BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
2011 <        if (key == null || remappingFunction == null)
2012 <            throw new NullPointerException();
2011 >        if (key == null || remappingFunction == null)
2012 >            throw new NullPointerException();
2013          Comparator<? super K> cmp;
2014          if ((cmp = comparator) == null) {
2015              Node<K,V> n; Object v;
# Line 2026 | Line 2026 | public class ConcurrentSkipListMap<K,V>
2026                      else if (doRemove(k, vv) != null)
2027                          break;
2028                  }
2029 <            }
2029 >            }
2030          }
2031          else {
2032              Node<K,V> n; Object v;
# Line 2042 | Line 2042 | public class ConcurrentSkipListMap<K,V>
2042                          break;
2043                  }
2044              }
2045 <        }
2046 <        return null;
2045 >        }
2046 >        return null;
2047      }
2048  
2049      /**
# Line 2059 | Line 2059 | public class ConcurrentSkipListMap<K,V>
2059       *         or the remappingFunction is null
2060       * @since 1.8
2061       */
2062 <    public V compute(K key,
2062 >    public V compute(K key,
2063                       BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
2064 <        if (key == null || remappingFunction == null)
2065 <            throw new NullPointerException();
2064 >        if (key == null || remappingFunction == null)
2065 >            throw new NullPointerException();
2066          Comparator<? super K> cmp;
2067          if ((cmp = comparator) == null) {
2068              @SuppressWarnings("unchecked") Comparable<? super K> k =
# Line 2106 | Line 2106 | public class ConcurrentSkipListMap<K,V>
2106                  }
2107              }
2108          }
2109 <        return null;
2109 >        return null;
2110      }
2111  
2112      /**
# Line 2126 | Line 2126 | public class ConcurrentSkipListMap<K,V>
2126       */
2127      public V merge(K key, V value,
2128                     BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
2129 <        if (key == null || value == null || remappingFunction == null)
2130 <            throw new NullPointerException();
2129 >        if (key == null || value == null || remappingFunction == null)
2130 >            throw new NullPointerException();
2131          Comparator<? super K> cmp;
2132          if ((cmp = comparator) == null) {
2133              @SuppressWarnings("unchecked") Comparable<? super K> k =
# Line 2166 | Line 2166 | public class ConcurrentSkipListMap<K,V>
2166                          return null;
2167                  }
2168              }
2169 <        }
2169 >        }
2170      }
2171  
2172      /* ---------------- View methods -------------- */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines