adjacentTo method Null safety

bool adjacentTo(
  1. Interval other
)

Implementation

bool adjacentTo(Interval other) {
  bool result;
  if (this.comes_before(other)) {
    if (this.upperBound == other.lowerBound) {
      result = this.upperClosed != other.lowerClosed;
    } else {
      result = false;
    }
  } else if (this == other) {
    result = false;
  } else {
    result = other.adjacentTo(this);
  }
  return result;
}