ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166e/ConcurrentHashMapV8.java
(Generate patch)

Comparing jsr166/src/jsr166e/ConcurrentHashMapV8.java (file contents):
Revision 1.12 by jsr166, Tue Aug 30 18:31:54 2011 UTC vs.
Revision 1.13 by jsr166, Wed Aug 31 00:22:11 2011 UTC

# Line 1105 | Line 1105 | public class ConcurrentHashMapV8<K, V>
1105       * If the specified key is not already associated with a value,
1106       * computes its value using the given mappingFunction, and if
1107       * non-null, enters it into the map.  This is equivalent to
1108 <     *
1109 <     * <pre>
1110 <     *   if (map.containsKey(key))
1111 <     *       return map.get(key);
1112 <     *   value = mappingFunction.map(key);
1113 <     *   if (value != null)
1114 <     *      map.put(key, value);
1115 <     *   return value;
1116 <     * </pre>
1108 >     *  <pre> {@code
1109 >     * if (map.containsKey(key))
1110 >     *   return map.get(key);
1111 >     * value = mappingFunction.map(key);
1112 >     * if (value != null)
1113 >     *   map.put(key, value);
1114 >     * return value;}</pre>
1115       *
1116       * except that the action is performed atomically.  Some attempted
1117       * update operations on this map by other threads may be blocked
# Line 1122 | Line 1120 | public class ConcurrentHashMapV8<K, V>
1120       * mappings of this Map. The most appropriate usage is to
1121       * construct a new object serving as an initial mapped value, or
1122       * memoized result, as in:
1123 <     * <pre>{@code
1123 >     *  <pre> {@code
1124       * map.computeIfAbsent(key, new MappingFunction<K, V>() {
1125 <     *   public V map(K k) { return new Value(f(k)); }};
1128 <     * }</pre>
1125 >     *   public V map(K k) { return new Value(f(k)); }});}</pre>
1126       *
1127       * @param key key with which the specified value is to be associated
1128       * @param mappingFunction the function to compute a value
# Line 1150 | Line 1147 | public class ConcurrentHashMapV8<K, V>
1147       * Computes the value associated with the given key using the given
1148       * mappingFunction, and if non-null, enters it into the map.  This
1149       * is equivalent to
1150 <     *
1151 <     * <pre>
1152 <     *   value = mappingFunction.map(key);
1153 <     *   if (value != null)
1154 <     *      map.put(key, value);
1155 <     *   else
1156 <     *      value = map.get(key);
1160 <     *   return value;
1161 <     * </pre>
1150 >     *  <pre> {@code
1151 >     * value = mappingFunction.map(key);
1152 >     * if (value != null)
1153 >     *   map.put(key, value);
1154 >     * else
1155 >     *   value = map.get(key);
1156 >     * return value;}</pre>
1157       *
1158       * except that the action is performed atomically.  Some attempted
1159       * update operations on this map by other threads may be blocked

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines