摘要: 在HashMap中,indexFor方法其实主要是将hashcode换成链表数组中的下标。 static int indexFor(int h, int length) { return h & (length-1); } 这里实际就是取模。 用位运算是因为它比取模运算效率要高很多,因为它是直接对内 阅读全文
posted @ 2021-08-23 23:08 Vincent-yuan 阅读(2598) 评论(0) 推荐(1)