Java | ConcurrentHashMap # get under JDK8

. 1   public V GET (Object Key) {
 2          the Node <K, V> [] Tab; the Node <K, V> E, P; int n-, EH; K EK;
 . 3           // address 
. 4          int H = Spread (Key .hashCode ());
 . 5          IF ! ((Tab = Table) = null && (= n-tab.length)> 0 &&
 . 6              (E = tabAt (Tab, (n--. 1) & H)) =! null ) {
 . 7              // hash value and the hash key of the head node is the same, it is determined whether the same key content known 
. 8              IF ((EH = e.hash) == H) {
 . 9                  IF ((EK = e.key) == || Key (EK! = null && key.equals (EK)))
 10                     return e.val;
 . 11              }
 12 is              // If the hash value of the node header eh <0 black tree looking directly stored 
13 is              the else  IF (eh <0 )
 14                  return (e.find P = (H, Key)) =! null ? p.val: null ;
 15              // list to find 
16              the while ((E = e.next) =! null {)
 17                  IF (e.hash && == H
 18                      ((EK = e.key) == Key | | (! EK = null && key.equals (EK))))
 . 19                      return e.val;
 20 is              }
 21 is         }
22         return null;
23     }

 

Guess you like

Origin www.cnblogs.com/jj81/p/11480056.html