math-doc-算法与优化

快速假取模

1
2
int hash = getHash(xx);
int idx = (len -1)&hash;

jdk1.8的hashmap优化

  • hash表的每个索引对应的都是一个链表
  • 当链表节点数量大于8的时候,改成用红黑色替换这个链表