union

infix fun union(other: Interval): List<Interval>

Calculates the union between this interval and another, as a list of intervals.

The union of two intervals is not necessarily an interval, if they do not overlap. In this case the two intervals are returned in the list separately. If they do overlap, the list will contain a single element which is the union interval.

If either interval is empty, it will not be included in the result.