/**
* Returns the number of key-value mappings in this map. If the
* map contains more than <tt>Integer.MAX_VALUE</tt> elements, returns
* <tt>Integer.MAX_VALUE</tt>.
*
* @return the number of key-value mappings in this map
*/
public int size() {
// Try a few times to get accurate count. On failure due to
// continuous async changes in table, resort to locking.
final Segment<K,V>[] segments = this.segments; //map数据从segments中拿取
int size; //统计的大小
boolean overflow; // true if size overflows 32 bits //size过大的溢出情况
long sum; // sum of modCounts 统计modCounts的值
long last = 0L; // previous sum 最近的一个sum值
int retries = -1; // first iteration isn't retry 重试的次数
try {
for (;;) { //一直循环统计size直至segment结构没有发生变化
if (retries++ &#