removeFirst

Tombstone the first count visible elements, minting one RgaOp.Remove each.

The bulk sibling of removeAt(0) repeated, and indistinguishable from it: the same ids tombstoned, in the same order. The cost differs the same way insertAllAfter's does — one ops + removes copy and one cache build for the whole run.

It also materializes sequence once rather than once per removal, though since #2193 that is the smaller half: removeAt now threads the order forward (a Remove cannot reorder anything, so the same list is handed on), and a loop of k removals computes it once too. Before that it was k full recomputations, which is why this paragraph used to call the sequence the larger saving.

Existing tombstones are skipped rather than counted, exactly as removeAt(0) skips them — count is a number of visible elements.

A count of zero or less returns this (the same instance, not a copy).

Return

the new state, and the ops to broadcast in removal order.

Throws