This is an automated email from the ASF dual-hosted git repository. jackietien pushed a commit to branch OptBinartEqualsMethod in repository https://gitbox.apache.org/repos/asf/tsfile.git
commit 73648e4311c94e0888c1a868d525698fc3f76d46 Author: JackieTien97 <[email protected]> AuthorDate: Mon Aug 26 17:49:10 2024 +0800 Optimize equals method in Binary --- .../src/main/java/org/apache/tsfile/utils/Binary.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/java/common/src/main/java/org/apache/tsfile/utils/Binary.java b/java/common/src/main/java/org/apache/tsfile/utils/Binary.java index d1dc347b..a4a69672 100644 --- a/java/common/src/main/java/org/apache/tsfile/utils/Binary.java +++ b/java/common/src/main/java/org/apache/tsfile/utils/Binary.java @@ -71,18 +71,15 @@ public class Binary implements Comparable<Binary>, Serializable { } @Override - public boolean equals(Object other) { - if (this == other) { + public boolean equals(Object o) { + if (this == o) { return true; } - if (other == null) { - return false; - } - if (getClass() != other.getClass()) { + if (o == null || getClass() != o.getClass()) { return false; } - - return compareTo((Binary) other) == 0; + Binary binary = (Binary) o; + return Arrays.equals(values, binary.values); } @Override
