union method
Returns the union of this interval and the other
interval.
In other words, the returned interval contains the points that are in either interval.
final a = Interval(0, 3);
final b = Interval(2, 5);
print(a.union(b)); // [[0, 5]]
Notice that a.union(b) = b.union(a)
.
The returned interval is the entire interval from the smaller start to the larger end, including any gap in between.
final a = Interval(0, 2);
final b = Interval(3, 5);
print(b.union(a)); // [0, 5]
Implementation
Interval union(Interval other) =>
Interval(_min(start, other.start), _max(end, other.end));