1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 00:08:51 -05:00

Use Objects.hash()

This commit is contained in:
Reinhard Pointner 2016-10-31 05:03:39 +08:00
parent a898826aff
commit de960c02da
5 changed files with 11 additions and 19 deletions

View File

@ -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);
}
}

View File

@ -1,32 +1,26 @@
package net.filebot.similarity;
import java.util.Arrays;
import java.util.Objects;
public class Match<Value, Candidate> {
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<Value, Candidate> {
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);

View File

@ -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

View File

@ -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<FileInfo> {
@ -41,7 +41,7 @@ public class SimpleFileInfo implements FileInfo, Comparable<FileInfo> {
@Override
public int hashCode() {
return Arrays.hashCode(new Object[] { getPath(), getLength() });
return Objects.hash(getPath(), getLength());
}
@Override

View File

@ -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<Object> {
@Override
public int hashCode() {
return Arrays.hashCode(new Object[] { year, month, day });
return Objects.hash(year, month, day);
}
@Override