besides abstract method

  1. @useResult
bool besides(
  1. Range<T> other
)

Returns true if an empty range exists between this and other.

Discrete ranges are not considered to be besides each other even though there are no elements "between them", i.e. [1..4] is not beside [5..7].

This function is reflexive and symmetric.

Examples

final a = Interval.closedOpen(1, 3);
final b = Interval.closedOpen(3, 5);

a.besides(b); // true, [1..3) is beside [3..5)
final a = Interval.closed(1, 3);
final b = Interval.open(3, 5);

a.besides(b); // true, [1..3] is beside (3..5)
final a = Interval.closed(1, 5);
final b = Interval.open(3, 7);

a.besides(b); // false, [1..5] is not beside (3..7)
final a = Interval.closed(1, 3);
final b = Interval.open(5, 7);

a.besides(b); // false, [1..3] is not beside (5..7)
final a = Interval.closed(1, 4);
final b = Interval.closed(5, 7);

a.besides(b); // false, [1..4] is not beside [5..7], discrete range

Implementation

@useResult bool besides(Range<T> other);