设计注意事项已记录在同一源文件中的第211行的代码注释中
* When bin lists are treeified, split, or untreeified, we keep* them in the same relative access/traversal order (i.e., field* Node.next) to better preserve locality, and to slightly* simplify handling of splits and traversals that invoke* iterator.remove. When using comparators on insertion, to keep a* total ordering (or as close as is required here) across* rebalancings, we compare classes and identityHashCodes as* tie-breakers.
由于通过迭代器删除映射无法触发调整大小,因此专门保留顺序的原因
resize是“更好地保留局部性,并稍微简化拆分的处理”,以及在策略上保持一致。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)