diff --git a/source/net/filebot/History.java b/source/net/filebot/History.java index f0ac0d62..535cbb64 100644 --- a/source/net/filebot/History.java +++ b/source/net/filebot/History.java @@ -7,12 +7,12 @@ import java.io.File; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Date; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.logging.Level; import javax.xml.bind.JAXBContext; @@ -71,7 +71,7 @@ public class History { @Override public int hashCode() { - return Arrays.hashCode(new Object[] { elements, date }); + return Objects.hash(elements, date); } } @@ -120,7 +120,7 @@ public class History { @Override public int hashCode() { - return Arrays.hashCode(new Object[] { to, from, dir }); + return Objects.hash(to, from, dir); } } diff --git a/source/net/filebot/similarity/Match.java b/source/net/filebot/similarity/Match.java index 2e8dcdf5..3277a0a0 100644 --- a/source/net/filebot/similarity/Match.java +++ b/source/net/filebot/similarity/Match.java @@ -1,32 +1,26 @@ package net.filebot.similarity; - -import java.util.Arrays; - +import java.util.Objects; public class Match { private final Value value; private final Candidate candidate; - public Match(Value value, Candidate candidate) { this.value = value; this.candidate = candidate; } - public Value getValue() { return value; } - public Candidate getCandidate() { return candidate; } - @Override public boolean equals(Object obj) { if (obj instanceof Match) { @@ -37,13 +31,11 @@ public class Match { return false; } - @Override public int hashCode() { - return Arrays.hashCode(new Object[] { value, candidate }); + return Objects.hash(value, candidate); } - @Override public String toString() { return String.format("[%s, %s]", value, candidate); diff --git a/source/net/filebot/similarity/SeasonEpisodeMatcher.java b/source/net/filebot/similarity/SeasonEpisodeMatcher.java index 65155a24..c91830a3 100644 --- a/source/net/filebot/similarity/SeasonEpisodeMatcher.java +++ b/source/net/filebot/similarity/SeasonEpisodeMatcher.java @@ -10,10 +10,10 @@ import static net.filebot.util.StringUtilities.*; import java.io.File; import java.util.ArrayList; -import java.util.Arrays; import java.util.IntSummaryStatistics; import java.util.LinkedHashSet; import java.util.List; +import java.util.Objects; import java.util.Set; import java.util.function.Function; import java.util.regex.MatchResult; @@ -256,7 +256,7 @@ public class SeasonEpisodeMatcher { @Override public int hashCode() { - return Arrays.hashCode(new Object[] { season, episode }); + return Objects.hash(season, episode); } @Override diff --git a/source/net/filebot/vfs/SimpleFileInfo.java b/source/net/filebot/vfs/SimpleFileInfo.java index 2e954149..253165ca 100644 --- a/source/net/filebot/vfs/SimpleFileInfo.java +++ b/source/net/filebot/vfs/SimpleFileInfo.java @@ -3,7 +3,7 @@ package net.filebot.vfs; import static net.filebot.util.FileUtilities.*; import java.io.File; -import java.util.Arrays; +import java.util.Objects; public class SimpleFileInfo implements FileInfo, Comparable { @@ -41,7 +41,7 @@ public class SimpleFileInfo implements FileInfo, Comparable { @Override public int hashCode() { - return Arrays.hashCode(new Object[] { getPath(), getLength() }); + return Objects.hash(getPath(), getLength()); } @Override diff --git a/source/net/filebot/web/SimpleDate.java b/source/net/filebot/web/SimpleDate.java index 24003271..45635edc 100644 --- a/source/net/filebot/web/SimpleDate.java +++ b/source/net/filebot/web/SimpleDate.java @@ -7,8 +7,8 @@ import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoField; import java.time.temporal.Temporal; -import java.util.Arrays; import java.util.Locale; +import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -80,7 +80,7 @@ public class SimpleDate implements Serializable, Comparable { @Override public int hashCode() { - return Arrays.hashCode(new Object[] { year, month, day }); + return Objects.hash(year, month, day); } @Override