Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit10932cc

Browse files
author
Egoscio
authored
Comparing Matrix size before content size.
1 parent067e39d commit10932cc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎DataStructures/Matrix/Matrix.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,14 @@ public Matrix multiply(Matrix other) throws RuntimeException {
211211
* @return boolean
212212
*/
213213
publicbooleanequals(Matrixother) {
214+
if (this.getRows() !=other.getRows() ||this.getColumns() !=other.getColumns())
215+
returnfalse;
216+
214217
for (inti =0;i <this.data.length;i++)
215218
for (intj =0;j <this.data[0].length;j++)
216219
if (this.data[i][j] !=other.data[i][j])
217220
returnfalse;
218-
221+
219222
returntrue;
220223
}
221224

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp