preprocessList

fun <V : IntervalLike<V>> preprocessList(list: List<V>, shouldCoalesce: V.(V) -> Boolean?): (CollectOptions) -> List<V>

Sanitizes a list of IntervalLike objects for use in a timeline.

  1. sorts the list by start time (or by end time if two start times are equal)

  2. coalesces the list if applicable

  3. wraps the list in a collect closure that truncates the list to a given set of CollectOptions

Return

a collect closure that produces a sorted, possibly coalesced, and bounded list

Parameters

list

the list to sanitize

shouldCoalesce

a maybe-null two-argument function of Vs that decides if they should be coalesced when they overlap. If null, no coalesce operation is performed.