question: private void combineEntries ( ArrayList < long [ ] > list , int total ) { Collections . sort ( list , this ) ; for ( int minGap = 10 ; minGap < total ; minGap += minGap / 2 ) { for ( int i = 0 ; i < list . size ( ) - 1 ; i ++ ) { long [ ] current = list . get ( i ) ; long [ ] next = list . get ( i + 1 ) ; if ( current [ 1 ] + minGap >= next [ 0 ] ) { current [ 1 ] = next [ 1 ] ; list . remove ( i + 1 ) ; i -- ; } } int searched = 0 ; for ( long [ ] range : list ) { searched += range [ 1 ] - range [ 0 ] + 1 ; } if ( searched > 2 * total || list . size ( ) < 100 ) { break ; } } }
target:  Combine entries if the size of the list is too large.