Comparing Matrix size before content size.

This commit is contained in:
Egoscio 2019-03-21 14:33:14 -07:00 committed by GitHub
parent 067e39dbf5
commit 10932ccab1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -211,6 +211,9 @@ public class Matrix {
* @return boolean
*/
public boolean equals(Matrix other) {
if (this.getRows() != other.getRows() || this.getColumns() != other.getColumns())
return false;
for (int i = 0; i < this.data.length; i++)
for (int j = 0; j < this.data[0].length; j++)
if (this.data[i][j] != other.data[i][j])