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

# Line 848 | Line 848 | public class ConcurrentHashMap<K, V>
848                      if (c != (pc = pk.getClass()) ||
849                          !(k instanceof Comparable) ||
850                          (dir = ((Comparable)k).compareTo((Comparable)pk)) == 0) {
851 <                        dir = (c == pc) ? 0 : c.getName().compareTo(pc.getName());
852 <                        TreeNode r = null, s = null, pl, pr;
853 <                        if (dir >= 0) {
854 <                            if ((pl = p.left) != null && h <= pl.hash)
855 <                                s = pl;
851 >                        if ((dir = (c == pc) ? 0 :
852 >                             c.getName().compareTo(pc.getName())) == 0) {
853 >                            TreeNode r = null, pl, pr; // check both sides
854 >                            if ((pr = p.right) != null && h >= pr.hash &&
855 >                                (r = getTreeNode(h, k, pr)) != null)
856 >                                return r;
857 >                            else if ((pl = p.left) != null && h <= pl.hash)
858 >                                dir = -1;
859 >                            else // nothing there
860 >                                return null;
861                          }
857                        else if ((pr = p.right) != null && h >= pr.hash)
858                            s = pr;
859                        if (s != null && (r = getTreeNode(h, k, s)) != null)
860                            return r;
862                      }
863                  }
864                  else
# Line 912 | Line 913 | public class ConcurrentHashMap<K, V>
913                      if (c != (pc = pk.getClass()) ||
914                          !(k instanceof Comparable) ||
915                          (dir = ((Comparable)k).compareTo((Comparable)pk)) == 0) {
916 <                        dir = (c == pc) ? 0 : c.getName().compareTo(pc.getName());
917 <                        TreeNode r = null, s = null, pl, pr;
918 <                        if (dir >= 0) {
919 <                            if ((pl = p.left) != null && h <= pl.hash)
920 <                                s = pl;
916 >                        TreeNode s = null, r = null, pr;
917 >                        if ((dir = (c == pc) ? 0 :
918 >                             c.getName().compareTo(pc.getName())) == 0) {
919 >                            if ((pr = p.right) != null && h >= pr.hash &&
920 >                                (r = getTreeNode(h, k, pr)) != null)
921 >                                return r;
922 >                            else // continue left
923 >                                dir = -1;
924                          }
925                          else if ((pr = p.right) != null && h >= pr.hash)
926                              s = pr;
# Line 2858 | Line 2862 | public class ConcurrentHashMap<K, V>
2862       * unchanged.  Some attempted update operations on this map by
2863       * other threads may be blocked while computation is in progress,
2864       * so the computation should be short and simple, and must not
2865 <     * attempt to update any other mappings of this Map. For example,
2862 <     * to either create or append new messages to a value mapping:
2865 >     * attempt to update any other mappings of this Map.
2866       *
2867       * @param key key with which the specified value is to be associated
2868       * @param remappingFunction the function to compute a value

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines