made getNextAfterLastPosition method public