union method

Interval<T> union(
  1. Interval<T> other
)

Returns the minimal interval enclosing this and other interval.

Implementation

Interval<T> union(Interval<T> other) => Interval<T>(
  lower.compareTo(other.lower) < 0 ? lower : other.lower,
  upper.compareTo(other.upper) > 0 ? upper : other.upper,
);