Skip to content

Commit

Permalink
[UPD] Simplify TaskType.equals and fix TaskType.hashCode
Browse files Browse the repository at this point in the history
  • Loading branch information
kostobog committed Nov 1, 2023
1 parent 5662348 commit 0306acd
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,21 +259,18 @@ public boolean equals(Object o) {
if (!(o instanceof TaskType)) return false;
TaskType taskType = (TaskType) o;

if(getEntityURI() != null)
return getEntityURI().equals(taskType.getEntityURI());
if(taskType.getEntityURI() != null)
return taskType.getEntityURI().equals(getEntityURI());
if(getCode() != null)
return getCode().equals(taskType.getCode());
if(taskType.getCode() != null)
return taskType.getCode().equals(getCode());
if(getEntityURI() != null)
return getEntityURI().equals(taskType.getEntityURI());

return false;
}

@Override
public int hashCode() {
return Objects.hash(getCode());
Object id = Optional.<Object>ofNullable(getCode()).orElse(getEntityURI());
return Objects.hash(id);
}

@Override
Expand Down

0 comments on commit 0306acd

Please sign in to comment.