Slight leaning toward the shorter version, since, in it, the value of isFirstOrLast is correct at all times.