Discuss / Java / 为什么 第一次 put 的时候 不会出现 空指针呢?

为什么 第一次 put 的时候 不会出现 空指针呢?

Topic source

为什么 第一次 put 的时候 不会出现 空指针呢?

p2  应该为空啊

🌙

#2 Created at ... [Delete] [Delete and Lock User]

之前怎么这么白,问的问题,我现在都看不懂了,懂了匿名内部类, compare 看起来轻松多了

Joker.fu_95

#3 Created at ... [Delete] [Delete and Lock User]

为空和自己比较

if (t == null) {    compare(key, key); // type (and possibly null) check    root = new Entry<>(key, value, null);    size = 1;    modCount++;    return null;}

  • 1

Reply