/**
* Replaces all linked nodes in bin at index for given hash unless
* table is too small, in which case resizes instead.
*/finalvoidtreeifyBin(Node<K,V>[] tab,int hash){int n, index; Node<K,V> e;//1,如果table数组为空,或者大小未超过64,则重置table大小if(tab == null ||(n = tab.length)< MIN_TREEIFY_CAPACITY)resize();//2,如果table大小超过64,把当前链表转换成红黑树elseif((e = tab[index =(n -1)& hash])!= null){
TreeNode<K,V> hd = null, tl = null;do{//2.1,循环链表,把每一个对象转换成红黑树,并绑定上下级关系
TreeNode<K,V> p =replacementTreeNode(e, null);if(tl == null)
hd = p;else{//并绑定上下级关系
p.prev = tl;
tl.next = p;}
tl = p;}while((e = e.next)!= null);//2.2 重置红黑树相关信息if((tab[index]= hd)!= null)
hd.treeify(tab);}}