RoyGood` 2021-01-25 13:22 采纳率: 0%
浏览 81

关于HashMap源码中的removeTreeNode方法

final void removeTreeNode(HashMap<K,V> map, Node<K,V>[] tab,
                          boolean movable) {
    int n;
    if (tab == null || (n = tab.length) == 0)
        return; 
    int index = (n - 1) & hash; 
    TreeNode<K,V> first = (TreeNode<K,V>)tab[index], root = first, rl;
    TreeNode<K,V> succ = (TreeNode<K,V>)next, pred = prev;
    if (pred == null)
        tab[index] = first = succ;
    else
        pred.next = succ;
    if (succ != null)
        succ.prev = pred; 
    if (first == null) 
        return; 
    if (root.parent != null)
        root = root.root();

代码太长,直到粘贴到的问题处

请问这个什么情况下会进入该条件

if (root.parent != null)
        root = root.root();

提前感谢你的回答!

  • 写回答

1条回答 默认 最新

  • _Cade_ 2021-07-26 20:56
    关注

    解决了吗? 我也不知道为啥要加这一句。 按道理正常使用不会有这种情况

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog