jixuan1989 commented on a change in pull request #32: fix sonar issues
URL: https://github.com/apache/incubator-iotdb/pull/32#discussion_r253106873
##########
File path:
iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/IntervalFileNode.java
##########
@@ -227,51 +230,33 @@ public int hashCode() {
}
@Override
- public boolean equals(Object obj) {
-
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- IntervalFileNode other = (IntervalFileNode) obj;
- if (endTimeMap == null) {
- if (other.endTimeMap != null) {
- return false;
- }
- } else if (!endTimeMap.equals(other.endTimeMap)) {
- return false;
- }
- if (relativePath == null) {
- if (other.relativePath != null) {
- return false;
- }
- } else if (!relativePath.equals(other.relativePath)) {
- return false;
- }
- if (overflowChangeType != other.overflowChangeType) {
- return false;
- }
- if (startTimeMap == null) {
- if (other.startTimeMap != null) {
- return false;
- }
- } else if (!startTimeMap.equals(other.startTimeMap)) {
- return false;
- }
- return true;
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ IntervalFileNode fileNode = (IntervalFileNode) o;
+ return baseDirIndex == fileNode.baseDirIndex &&
+ overflowChangeType == fileNode.overflowChangeType &&
+ Objects.equals(relativePath, fileNode.relativePath) &&
+ Objects.equals(startTimeMap, fileNode.startTimeMap) &&
Review comment:
> 你试过吗,我不确定能不能行
I tried.
```java
public static void main(String[] args) {
Map<String, Integer> map1 = new HashMap<>();
Map<String, Integer> map2 = new HashMap<>();
map1.put("a", 1);
map1.put("bcdefghijklmn", 2);
map2.put("a", 1);
map2.put("bcdefghijklmn", 2);
System.out.println(Objects.equals(map1, map2));
}
```
Result is true.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services