We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5a934c1 + 10932cc commit cd60c39Copy full SHA for cd60c39
DataStructures/Matrix/Matrix.java
@@ -211,7 +211,15 @@ public Matrix multiply(Matrix other) throws RuntimeException {
211
* @return boolean
212
*/
213
public boolean equals(Matrix other) {
214
- return this == other;
+ if (this.getRows() != other.getRows() || this.getColumns() != other.getColumns())
215
+ return false;
216
+
217
+ for (int i = 0; i < this.data.length; i++)
218
+ for (int j = 0; j < this.data[0].length; j++)
219
+ if (this.data[i][j] != other.data[i][j])
220
221
222
+ return true;
223
}
224
225
/**
0 commit comments