private int intersectionSize ( int [ ] px , int [ ] py ) { int i = 0 , j = 0 , c = 0 ; while ( i < px . length && j < py . length ) { final int vx = px [ i ] , vy = py [ j ] ; if ( vx < vy ) { ++ i ; } else if ( vx > vy ) { ++ j ; } else { ++ c ; ++ i ; ++ j ; } } return c ; }
Compute the intersection of two sorted integer lists .