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.80 by jsr166, Sat Nov 24 03:46:28 2012 UTC vs.
Revision 1.81 by dl, Sat Dec 8 14:10:38 2012 UTC

# Line 867 | Line 867 | public class ConcurrentHashMapV8<K, V>
867                      if (c != (pc = pk.getClass()) ||
868                          !(k instanceof Comparable) ||
869                          (dir = ((Comparable)k).compareTo((Comparable)pk)) == 0) {
870 <                        dir = (c == pc) ? 0 : c.getName().compareTo(pc.getName());
871 <                        TreeNode r = null, s = null, pl, pr;
872 <                        if (dir >= 0) {
873 <                            if ((pl = p.left) != null && h <= pl.hash)
874 <                                s = pl;
870 >                        if ((dir = (c == pc) ? 0 :
871 >                             c.getName().compareTo(pc.getName())) == 0) {
872 >                            TreeNode r = null, pl, pr; // check both sides
873 >                            if ((pr = p.right) != null && h >= pr.hash &&
874 >                                (r = getTreeNode(h, k, pr)) != null)
875 >                                return r;
876 >                            else if ((pl = p.left) != null && h <= pl.hash)
877 >                                dir = -1;
878 >                            else // nothing there
879 >                                return null;
880                          }
876                        else if ((pr = p.right) != null && h >= pr.hash)
877                            s = pr;
878                        if (s != null && (r = getTreeNode(h, k, s)) != null)
879                            return r;
881                      }
882                  }
883                  else
# Line 931 | Line 932 | public class ConcurrentHashMapV8<K, V>
932                      if (c != (pc = pk.getClass()) ||
933                          !(k instanceof Comparable) ||
934                          (dir = ((Comparable)k).compareTo((Comparable)pk)) == 0) {
935 <                        dir = (c == pc) ? 0 : c.getName().compareTo(pc.getName());
936 <                        TreeNode r = null, s = null, pl, pr;
937 <                        if (dir >= 0) {
938 <                            if ((pl = p.left) != null && h <= pl.hash)
939 <                                s = pl;
935 >                        TreeNode s = null, r = null, pr;
936 >                        if ((dir = (c == pc) ? 0 :
937 >                             c.getName().compareTo(pc.getName())) == 0) {
938 >                            if ((pr = p.right) != null && h >= pr.hash &&
939 >                                (r = getTreeNode(h, k, pr)) != null)
940 >                                return r;
941 >                            else // continue left
942 >                                dir = -1;
943                          }
944                          else if ((pr = p.right) != null && h >= pr.hash)
945                              s = pr;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines