public static List < ByteBuffer > mergeMin ( List < ByteBuffer > minColumnNames , List < ByteBuffer > candidates , CellNameType comparator ) { if ( minColumnNames . isEmpty ( ) ) return minimalBuffersFor ( candidates ) ; if ( candidates . isEmpty ( ) ) return minColumnNames ; List < ByteBuffer > biggest = minColumnNames . size ( ) > candidates . size ( ) ? minColumnNames : candidates ; List < ByteBuffer > smallest = minColumnNames . size ( ) > candidates . size ( ) ? candidates : minColumnNames ; // We want to always copy the smallest list, and maybeGrow does it only if it's actually smaller List < ByteBuffer > retList = smallest . size ( ) == biggest . size ( ) ? new ArrayList <> ( smallest ) : maybeGrow ( smallest , biggest . size ( ) ) ; for ( int i = 0 ; i < biggest . size ( ) ; i ++ ) retList . set ( i , minimalBufferFor ( min ( retList . get ( i ) , biggest . get ( i ) , comparator . subtype ( i ) ) ) ) ; return retList ; }
Merge 2 lists of min cell name components .