As per Sun Java Implementation, during expansion, ArrayList grows to 3/2 it's initial capacity whereas for HashMap the expansion rate is double. What is reason behind this?
As per the implementation, for HashMap, the capacity should always be in the power of two. That may be a reason for HashMap's behavior. But in that case the question is, for HashMap why the capacity should always be in power of two?
以上就是Why ArrayList grows at a rate of 1.5, but for Hashmap it's 2?的详细内容,更多请关注web前端其它相关文章!