Skip to content

Commit 15e1d92

Browse files
RATIS-2310. Implement hashCode and equals method for SizeInBytes class. (#1272)
1 parent 3612bca commit 15e1d92

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ratis-common/src/main/java/org/apache/ratis/util/SizeInBytes.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,14 @@ public String getInput() {
8383
public String toString() {
8484
return description;
8585
}
86+
87+
@Override
88+
public boolean equals(Object obj) {
89+
return obj instanceof SizeInBytes && size == ((SizeInBytes)obj).size;
90+
}
91+
92+
@Override
93+
public int hashCode() {
94+
return Long.hashCode(size);
95+
}
8696
}

0 commit comments

Comments
 (0)