RangeOfSlots

Represents a range of slots, where each slot is either vacant or occupied by an integer whose value corresponds to the slot position, taken zero-relative.

The idea is to start with an initial instance whose slots are all vacant, then to add items in at some vacant slot without knowing the exact slot position; instead we specify the vacant slot's index wrt the rest of the vacant slots without caring about the ones already filled.

Companion:
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def fillVacantSlotAtIndex(indexOfVacantSlotAsCountedByVacanciesOnly: Int): (Int, RangeOfSlots)

Fill in a vacant slot with a value that denotes the slot's position.

Fill in a vacant slot with a value that denotes the slot's position.

Value parameters:
indexOfVacantSlotAsCountedByVacanciesOnly

Picks out a vacant slot, the value must range from 0 to one less than the number of vacant slots.

Returns:

The position of the filled slot and this with the given vacant slot filled.

Note:

We don't specify or expect to know the exact slot position, rather we work in terms of how many vacant slots there are.