Skip to content

Commit 38a70c9

Browse files
perf: use $hashCode in equals()
Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
1 parent 4c3935e commit 38a70c9

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pbj-core/pbj-compiler/src/main/java/com/hedera/pbj/compiler/impl/generators/ModelGenerator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,9 @@ public boolean equals(Object that) {
433433
return false;
434434
}
435435
$javaRecordName thatObj = ($javaRecordName)that;
436+
if ($hashCode != -1 && thatObj.$hashCode != -1 && $hashCode != thatObj.$hashCode) {
437+
return false;
438+
}
436439
""".replace("$javaRecordName", javaRecordName).indent(DEFAULT_INDENT);
437440

438441
bodyContent += equalsStatements.indent(DEFAULT_INDENT);

pbj-core/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.11.0-SNAPSHOT
1+
0.11.1-SNAPSHOT

0 commit comments

Comments
 (0)