summaryrefslogtreecommitdiff
path: root/src/main/java/sevenUnitsGUI/PrefixSearchRule.java
diff options
context:
space:
mode:
authorAdrien Hopkins <ahopk127@my.yorku.ca>2022-07-17 14:17:37 -0500
committerAdrien Hopkins <ahopk127@my.yorku.ca>2022-07-17 14:17:37 -0500
commitd75177860e9b811e84cd79efc0c1d29445aeaba2 (patch)
tree777c61bc3c7ce82eb50ad95b4ad1e626f463c8f9 /src/main/java/sevenUnitsGUI/PrefixSearchRule.java
parent6178211ce0f280c7630b0ca6244ab547270650c6 (diff)
Added more PrefixSearchRule tests
Diffstat (limited to 'src/main/java/sevenUnitsGUI/PrefixSearchRule.java')
-rw-r--r--src/main/java/sevenUnitsGUI/PrefixSearchRule.java22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/main/java/sevenUnitsGUI/PrefixSearchRule.java b/src/main/java/sevenUnitsGUI/PrefixSearchRule.java
index a62ccda..a5034c9 100644
--- a/src/main/java/sevenUnitsGUI/PrefixSearchRule.java
+++ b/src/main/java/sevenUnitsGUI/PrefixSearchRule.java
@@ -21,6 +21,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Objects;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
@@ -136,17 +137,8 @@ public final class PrefixSearchRule implements
if (!(obj instanceof PrefixSearchRule))
return false;
final PrefixSearchRule other = (PrefixSearchRule) obj;
- if (this.prefixableUnitRule == null) {
- if (other.prefixableUnitRule != null)
- return false;
- } else if (!this.prefixableUnitRule.equals(other.prefixableUnitRule))
- return false;
- if (this.prefixes == null) {
- if (other.prefixes != null)
- return false;
- } else if (!this.prefixes.equals(other.prefixes))
- return false;
- return true;
+ return Objects.equals(this.prefixableUnitRule, other.prefixableUnitRule)
+ && Objects.equals(this.prefixes, other.prefixes);
}
/**
@@ -169,13 +161,7 @@ public final class PrefixSearchRule implements
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (this.prefixableUnitRule == null ? 0
- : this.prefixableUnitRule.hashCode());
- result = prime * result
- + (this.prefixes == null ? 0 : this.prefixes.hashCode());
- return result;
+ return Objects.hash(this.prefixableUnitRule, this.prefixes);
}
@Override