Doubt in findNextIndex function

If the statement is true why we have to return index+1 in in the right place topic