Why list.size-1 is done while calculating Id

Why list.size-1 is done while calculating ID

because ID starts from 0 index and not from 1.