Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit aa26795

Browse files
committed
Use Guava-based equals and hashCode
1 parent be51834 commit aa26795

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

src/main/java/org/cryptomator/cloudaccess/api/CloudItemMetadata.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.cryptomator.cloudaccess.api;
22

3+
import com.google.common.base.Objects;
4+
35
import java.nio.file.Path;
46
import java.time.Instant;
57
import java.util.Optional;
@@ -47,23 +49,16 @@ public Optional<Long> getSize() {
4749
public boolean equals(Object o) {
4850
if (this == o) return true;
4951
if (o == null || getClass() != o.getClass()) return false;
50-
5152
CloudItemMetadata that = (CloudItemMetadata) o;
52-
53-
if (!name.equals(that.name)) return false;
54-
if (!path.equals(that.path)) return false;
55-
if (itemType != that.itemType) return false;
56-
if (!lastModifiedDate.equals(that.lastModifiedDate)) return false;
57-
return size.equals(that.size);
53+
return Objects.equal(this.name, that.name) &&
54+
Objects.equal(this.path, that.path) &&
55+
this.itemType == that.itemType &&
56+
Objects.equal(this.lastModifiedDate, that.lastModifiedDate) &&
57+
Objects.equal(this.size, that.size);
5858
}
5959

6060
@Override
6161
public int hashCode() {
62-
int result = name.hashCode();
63-
result = 31 * result + path.hashCode();
64-
result = 31 * result + itemType.hashCode();
65-
result = 31 * result + lastModifiedDate.hashCode();
66-
result = 31 * result + size.hashCode();
67-
return result;
62+
return Objects.hashCode(name, path, itemType, lastModifiedDate, size);
6863
}
6964
}

0 commit comments

Comments
 (0)