equivalent method Null safety

bool equivalent(
  1. AMatrix other
)

Implementation

bool equivalent(AMatrix other) {
  if (other.rows != rows && other.columns != columns) {
    return false;
  } else {
    for (int i = 0; i < rows; i++) {
      for (int j = 0; j < columns; j++) {
        if (get(i, j) != other.get(i, j)) {
          return false;
        }
      }
    }
    return true;
  }
}