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.205 by dl, Thu Apr 11 20:13:38 2013 UTC vs.
Revision 1.206 by dl, Thu Apr 11 23:17:43 2013 UTC

# Line 321 | Line 321 | public class ConcurrentHashMap<K,V>
321       * a threshold, and at least one of the keys implements
322       * Comparable.  These TreeBins use a balanced tree to hold nodes
323       * (a specialized form of red-black trees), bounding search time
324 <     * to O(log N).  Each search step in a TreeBin is around twice as
324 >     * to O(log N).  Each search step in a TreeBin is at least twice as
325       * slow as in a regular list, but given that N cannot exceed
326       * (1<<64) (before running out of addresses) this bounds search
327       * steps, lock hold times, etc, to reasonable constants (roughly
# Line 772 | Line 772 | public class ConcurrentHashMap<K,V>
772                      return p;
773                  else if (cc == null || comparableClassFor(pk) != cc ||
774                           (dir = ((Comparable<Object>)k).compareTo(pk)) == 0) {
775 <                    TreeNode<V> r, pl, pr; // check both sides
775 >                    TreeNode<V> r, pr; // check both sides
776                      if ((pr = p.right) != null && h >= pr.hash &&
777                          (r = getTreeNode(h, k, pr, cc)) != null)
778                          return r;
779 <                    else if ((pl = p.left) != null && h <= pl.hash)
779 >                    else // continue left
780                          dir = -1;
781                    else // nothing there
782                        break;
781                  }
782                  p = (dir > 0) ? p.right : p.left;
783              }
# Line 823 | Line 821 | public class ConcurrentHashMap<K,V>
821              TreeNode<V> pp = root, p = null;
822              int dir = 0;
823              while (pp != null) { // find existing node or leaf to insert at
824 <                int ph;  Object pk;
824 >                int ph; Object pk;
825                  p = pp;
826                  if ((ph = p.hash) != h)
827                      dir = (h < ph) ? -1 : 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines