hashCode and equals

This commit is contained in:
2015-07-12 18:14:26 +02:00
parent 904d1f64f1
commit 9a0a54bebb
24 changed files with 160 additions and 128 deletions
@@ -217,9 +217,9 @@ public class FontHelper {
public static class KerningPair {
public char char1;
public final char char1;
public char char2;
public final char char2;
public int kerning;
@@ -247,13 +247,13 @@ public class FontHelper {
return false;
}
final KerningPair other = (KerningPair) obj;
if (this.char1 != other.char1) {
if (char1 != other.char1) {
return false;
}
if (this.char2 != other.char2) {
if (char2 != other.char2) {
return false;
}
if (this.kerning != other.kerning) {
if (kerning != other.kerning) {
return false;
}
return true;
@@ -44,8 +44,8 @@ public class MyEntry<K, V> implements Entry<K, V> {
@Override
public int hashCode() {
int hash = 7;
hash = 61 * hash + Objects.hashCode(this.key);
hash = 61 * hash + Objects.hashCode(this.value);
hash = 61 * hash + Objects.hashCode(key);
hash = 61 * hash + Objects.hashCode(value);
return hash;
}
@@ -57,12 +57,11 @@ public class MyEntry<K, V> implements Entry<K, V> {
if (getClass() != obj.getClass()) {
return false;
}
@SuppressWarnings("unchecked")
final MyEntry<K, V> other = (MyEntry<K, V>) obj;
if (!Objects.equals(this.key, other.key)) {
final MyEntry<?, ?> other = (MyEntry<?, ?>) obj;
if (!Objects.equals(key, other.key)) {
return false;
}
if (!Objects.equals(this.value, other.value)) {
if (!Objects.equals(value, other.value)) {
return false;
}
return true;