summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/backup/incremental/ObjectElement.java
diff options
context:
space:
mode:
authorKeuin <[email protected]>2021-01-22 18:59:47 +0800
committerkeuin <[email protected]>2021-01-22 18:59:47 +0800
commit1c23fc14be8a0ac9542f1412448c4d896756ba01 (patch)
tree98a89f19f84877d24a99f9a256408e46b4c32f29 /src/main/java/com/keuin/kbackupfabric/backup/incremental/ObjectElement.java
parent2f1d2ec7ddaebbbd19cde6314afa873f6fb964f4 (diff)
Speed up the incremental backup by using multiple CPU cores if available (use multiple threads to calculate the hash).
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/backup/incremental/ObjectElement.java')
-rw-r--r--src/main/java/com/keuin/kbackupfabric/backup/incremental/ObjectElement.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/backup/incremental/ObjectElement.java b/src/main/java/com/keuin/kbackupfabric/backup/incremental/ObjectElement.java
index 0bb7873..ee677fa 100644
--- a/src/main/java/com/keuin/kbackupfabric/backup/incremental/ObjectElement.java
+++ b/src/main/java/com/keuin/kbackupfabric/backup/incremental/ObjectElement.java
@@ -1,6 +1,7 @@
package com.keuin.kbackupfabric.backup.incremental;
import com.keuin.kbackupfabric.backup.incremental.identifier.ObjectIdentifier;
+import org.jetbrains.annotations.NotNull;
import java.io.Serializable;
import java.util.Objects;
@@ -9,7 +10,7 @@ import java.util.Objects;
* Representing a file in a ObjectCollection.
* Immutable.
*/
-public class ObjectElement implements Serializable {
+public class ObjectElement implements Serializable, Comparable<ObjectElement> {
private final String name;
private final ObjectIdentifier identifier;
@@ -57,4 +58,9 @@ public class ObjectElement implements Serializable {
", identifier=" + identifier +
'}';
}
+
+ @Override
+ public int compareTo(@NotNull ObjectElement objectElement) {
+ return name.compareTo(objectElement.name);
+ }
}