gap abstract method

  1. @useResult
Interval<T>? gap(
  1. Range<T> other
)

If this does not intersect other, returns the gap in between. Otherwise returns null.

final foo = Interval.open(1, 5);
final bar = Interval.closed(7, 9);

foo.gap(bar); // { x | 5 <= x < 7 }


Min.closed(7).gap(Max.open(5)); // { x | 5 <= x < 7 }

Max.closed(5).gap(Interval.open(7, 9)); // { x | 5 < x <= 7 }

Interval.open(1, 5).gap(Interval.closed(3, 7)); // null

Implementation

@useResult Interval<T>? gap(Range<T> other);