protected boolean slowEquals()

in ndarray/src/main/java/org/tensorflow/ndarray/impl/buffer/AbstractDataBuffer.java [101:127]


  protected boolean slowEquals(DataBuffer<?> other) {
    if (other.size() != size()) {
      return false;
    }
    long idx = 0L;
    for (; idx < size(); ++idx) {
      Object thisObject = getObject(idx);
      if (thisObject != null) {
        if (thisObject.getClass().isArray()) {
          return arrayEquals(idx, thisObject.getClass(), other);
        }
        if (!Objects.equals(other.getObject(idx), thisObject)) {
          return false;
        }
        break;  // continue equality comparison without array type check
      }
      if (other.getObject(idx) != null) {
        return false;
      }
    }
    while (++idx < size()) {
      if (!Objects.equals(other.getObject(idx), getObject(idx))) {
        return false;
      }
    }
    return true;
  }