Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
final class MatrixCoordinate {

private final int row;

private final int col;

MatrixCoordinate(final int row, final int col) {
this.row = row;
this.col = col;
}

// Generated equals and hashcode.

@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

final MatrixCoordinate that = (MatrixCoordinate) o;

return row == that.row && col == that.col;
}

@Override
public int hashCode() {
int result = row;
result = 31 * result + col;
return result;
}

class MatrixCoordinate {
private final int row;
private final int col;

MatrixCoordinate(final int row, final int col) {
this.row = row;
this.col = col;
}

@Override
public String toString() {
return "Row: " + row + ", Column: " + col;
}

// Generated equals and hashcode.

@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

final MatrixCoordinate that = (MatrixCoordinate) o;

return row == that.row && col == that.col;
}

@Override
public int hashCode() {
int result = row;
result = 31 * result + col;
return result;
}
}
46 changes: 24 additions & 22 deletions exercises/saddle-points/src/main/java/MatrixCoordinate.java
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
class MatrixCoordinate {
private final int row;
private final int col;

private final int row;
MatrixCoordinate(final int row, final int col) {
this.row = row;
this.col = col;
}

private final int col;
@Override
public String toString() {
return "Row: " + row + ", Column: " + col;
}

MatrixCoordinate(final int row, final int col) {
this.row = row;
this.col = col;
}
// Generated equals and hashcode.

// Generated equals and hashcode.
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final MatrixCoordinate that = (MatrixCoordinate) o;

final MatrixCoordinate that = (MatrixCoordinate) o;

return row == that.row && col == that.col;
}

@Override
public int hashCode() {
int result = row;
result = 31 * result + col;
return result;
}
return row == that.row && col == that.col;
}

@Override
public int hashCode() {
int result = row;
result = 31 * result + col;
return result;
}
}