参考:
ArrayList扩容详解_java编程艺术的博客-CSDN博客_arraylist扩容
ArrayList底层是数组elementData,用于存放插入的数据。初始大小是0,当有数据插入时,默认大小DEFAULT_CAPACITY = 10。如果在创建ArrayList时指定了initialCapacity,则初始大小是ArrayList
oldCapacity + (oldCapacity >> 1)。
capacity:10,size:1
capacity:15,size:11
capacity:22,size:16
capacity:33,size:23
capacity:49,size:34
capacity:73,size:50
capacity:109,size:74
>>1 大概就是除于2,例如每位都左移,加上2的3次,变成2的2次,相当于每个位置都除以2。结果就是除以2。反之
标签:扩容,10,arrayList,面试,oldCapacity,ArrayList,size From: https://www.cnblogs.com/longsanshi/p/17081853.html