private static Integer [ ] mergeDocLists ( Integer [ ] a , Integer [ ] b ) { Integer [ ] answer = new Integer [ a . length + b . length ] ; int i = 0 ; int j = 0 ; int k = 0 ; Integer tmp ; while ( i < a . length && j < b . length ) { tmp = a [ i ] < b [ j ] ? a [ i ++ ] : b [ j ++ ] ; for ( ; i < a . length && a [ i ] . equals ( tmp ) ; i ++ ) ; for ( ; j < b . length && b [ j ] . equals ( tmp ) ; j ++ ) ; answer [ k ++ ] = tmp ; } while ( i < a . length ) { tmp = a [ i ++ ] ; for ( ; i < a . length && a [ i ] . equals ( tmp ) ; i ++ ) ; answer [ k ++ ] = tmp ; } while ( j < b . length ) { tmp = b [ j ++ ] ; for ( ; j < b . length && b [ j ] . equals ( tmp ) ; j ++ ) ; answer [ k ++ ] = tmp ; } return Arrays . copyOf ( answer , k ) ; }
Merge doc lists .