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

Comparing jsr166/src/main/java/util/concurrent/ConcurrentHashMap.java (file contents):
Revision 1.194 by dl, Wed Mar 13 12:39:01 2013 UTC vs.
Revision 1.195 by dl, Sat Mar 16 16:03:08 2013 UTC

# Line 2222 | Line 2222 | public class ConcurrentHashMap<K,V>
2222                  this.baseSize = it.baseSize;
2223                  int hi = this.baseLimit = it.baseLimit;
2224                  it.baseLimit = this.index = this.baseIndex =
2225 <                    (hi + it.baseIndex + 1) >>> 1;
2225 >                    (hi + it.baseIndex) >>> 1;
2226              }
2227          }
2228  
# Line 2242 | Line 2242 | public class ConcurrentHashMap<K,V>
2242                  this.baseSize = it.baseSize;
2243                  int hi = this.baseLimit = it.baseLimit;
2244                  it.baseLimit = this.index = this.baseIndex =
2245 <                    (hi + it.baseIndex + 1) >>> 1;
2245 >                    (hi + it.baseIndex) >>> 1;
2246                  this.batch = it.batch >>>= 1;
2247              }
2248          }
# Line 2371 | Line 2371 | public class ConcurrentHashMap<K,V>
2371              Node<V>[] t; int i, len, n;
2372              if ((t = tab) != null && baseSize == (len = t.length) &&
2373                  len >= (n = baseLimit) && baseIndex == (i = index)) {
2374                Node<V> e = next;
2374                  index = baseIndex = n;
2376                next = null;
2375                  nextVal = null;
2376 +                Node<V> e = next;
2377 +                next = null;
2378 +                if (e != null)
2379 +                    e = e.next;
2380                  outer: for (;; e = e.next) {
2381                      V v; Object ek;
2382                      for (; e == null; ++i) {
# Line 2404 | Line 2406 | public class ConcurrentHashMap<K,V>
2406              Node<V>[] t; int i, len, n;
2407              if ((t = tab) != null && baseSize == (len = t.length) &&
2408                  len >= (n = baseLimit) && baseIndex == (i = index)) {
2407                Node<V> e = next;
2409                  index = baseIndex = n;
2409                next = null;
2410                  nextVal = null;
2411 +                Node<V> e = next;
2412 +                next = null;
2413 +                if (e != null)
2414 +                    e = e.next;
2415                  outer: for (;; e = e.next) {
2416                      for (; e == null; ++i) {
2417                          if (i < 0 || i >= n)
# Line 2643 | Line 2647 | public class ConcurrentHashMap<K,V>
2647       * @return the mapping for the key, if present; else the defaultValue
2648       * @throws NullPointerException if the specified key is null
2649       */
2650 <    public V getValueOrDefault(Object key, V defaultValue) {
2650 >    public V getOrDefault(Object key, V defaultValue) {
2651          V v;
2652          return (v = internalGet(key)) == null ? defaultValue : v;
2653      }
# Line 3075 | Line 3079 | public class ConcurrentHashMap<K,V>
3079              super(map, it);
3080          }
3081          public Spliterator<K> trySplit() {
3082 <            return (baseIndex >= baseLimit) ? null :
3082 >            return (baseLimit - baseIndex <= 1) ? null :
3083                  new KeyIterator<K,V>(map, this);
3084          }
3085          public final K next() {
# Line 3118 | Line 3122 | public class ConcurrentHashMap<K,V>
3122              super(map, it);
3123          }
3124          public Spliterator<V> trySplit() {
3125 <            return (baseIndex >= baseLimit) ? null :
3125 >            return (baseLimit - baseIndex <= 1) ? null :
3126                  new ValueIterator<K,V>(map, this);
3127          }
3128  
# Line 3160 | Line 3164 | public class ConcurrentHashMap<K,V>
3164              super(map, it);
3165          }
3166          public Spliterator<Map.Entry<K,V>> trySplit() {
3167 <            return (baseIndex >= baseLimit) ? null :
3167 >            return (baseLimit - baseIndex <= 1) ? null :
3168                  new EntryIterator<K,V>(map, this);
3169          }
3170  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines