This is an automated email from the ASF dual-hosted git repository. jackietien pushed a commit to branch iotdb in repository https://gitbox.apache.org/repos/asf/tsfile.git
commit 20a94fb3068519e4d1d19e8394effb70444d69e2 Author: Jackie Tien <[email protected]> AuthorDate: Mon Aug 26 18:56:31 2024 +0800 Optimize equals method in Binary (#217) --- .../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
