摘要: 最近看hashmap源码时,发现给定初始capacity计算threshold的过程很巧妙。 1 static final int tableSizeFor(int cap) { 2 int n = cap - 1; 3 n |= n >>> 1; 4 n |= n >>> 2; 5 n |= n 阅读全文
posted @ 2021-03-30 09:51 凝冰物语 阅读(105) 评论(0) 推荐(0) 编辑