The loop terminates when either of two pointers become null , or they cross each other ( second . next == first ) , or they become same ( first == second )
while ( first != null && second != null && first != second && second . next != first ) {