Change equals and hashcode in Recording to only use the ID
This commit is contained in:
parent
fcbe4a2e25
commit
e49ef57f21
|
@ -222,9 +222,7 @@ public class Recording implements Serializable {
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
result = prime * result + ((getStartDate() == null) ? 0 : (int) (getStartDate().toEpochMilli() ^ (getStartDate().toEpochMilli() >>> 32)));
|
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||||
result = prime * result + ((model == null) ? 0 : model.hashCode());
|
|
||||||
result = prime * result + ((getAbsoluteFile() == null) ? 0 : getAbsoluteFile().hashCode());
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,27 +232,14 @@ public class Recording implements Serializable {
|
||||||
return true;
|
return true;
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
return false;
|
return false;
|
||||||
if(!(obj instanceof Recording)) {
|
if (getClass() != obj.getClass())
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
Recording other = (Recording) obj;
|
Recording other = (Recording) obj;
|
||||||
if (getModel() == null) {
|
if (id == null) {
|
||||||
if (other.getModel() != null) {
|
if (other.id != null)
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (!id.equals(other.id))
|
||||||
} else if (!getModel().equals(other.getModel())) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
if (!getAbsoluteFile().equals(other.getAbsoluteFile())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getStartDate() == null) {
|
|
||||||
if (other.getStartDate() != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (getStartDate().toEpochMilli() != other.getStartDate().toEpochMilli()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue