This is an automated email from the ASF dual-hosted git repository.
jiangtian pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/tsfile.git
The following commit(s) were added to refs/heads/develop by this push:
new cd8f9040 Optimize equals method in Binary (#217)
cd8f9040 is described below
commit cd8f9040a036edaff852f8631163b8a091245933
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