synchronized void add ( long size , int generation ) { Preconditions . checkArgument ( size >= 0 , "size must be a non-negative number" ) ; Preconditions . checkArgument ( generation >= 0 , "generation must be a non-negative number" ) ; this . totalSize += size ; int newCount = this . generations . getOrDefault ( generation , 0 ) + 1 ; this . generations . put ( generation , newCount ) ; }
Records the addition of an element of the given size to the given generation .