ListEvent & the deleted elementI'm working on making the deleted element available in every ListEvent. The difficult part is providing that value when the EventList is describing its change to its listeners via our
ListEventprovide a lot of functionality that developers don't even have to think about:
- When describing a change you can mark elements as deleted in any order you like. But the recipient EventList always receives its events in increasing order. This is useful for classes like SortedList which naturally scrambles the order of its input events.
- When describing a change, you can mark an element as inserted, and then later mark that same element as deleted. ListEventAssembler will reduce this to a no-op. This is useful for RangeList, which internally handles the changes before readjusting its range offset.
elementUpdated()call means that the value at index 5 used to be 'alpha' and now it's something new. The
elementRemoved()call means that the value at index 5 has now been deleted, and it's initial value was "beta".
In this case
ListEventAssemblermerges these two calls:
The 'alpha' stands because it happened first, but the 'remove' stands because it happened last. It's counterintuitive, but it is exactly what the