The best way to avoid poor performance caused by multiple reallocations is to set the initial capacity to be the estimated size of the collection.
英
美
- 避免因多次重新分配导致不佳性能的最佳方法是将初始容量设置为集合的估计的大小。