RED-6411 - optimize method

This commit is contained in:
Thomas Beyer 2023-03-28 11:23:52 +02:00
parent 8409b61f40
commit c7643da478

View File

@ -289,11 +289,14 @@ public final class EntitySearchUtils {
}
}
private boolean isOneARecommendationAndTheOtherEntity (Entity found, Entity existing) {
private boolean isOneARecommendationAndTheOtherEntity(Entity entityOne, Entity entityTwo) {
return existing.getEntityType().equals(EntityType.RECOMMENDATION) && found.getEntityType().equals(EntityType.ENTITY) || existing.getEntityType()
.equals(EntityType.ENTITY) && found.getEntityType().equals(EntityType.RECOMMENDATION);
var entityTypeOne = entityOne.getEntityType();
var entityTypeTwo = entityTwo.getEntityType();
return entityTypeTwo.equals(EntityType.RECOMMENDATION) && entityTypeOne.equals(EntityType.ENTITY)
|| entityTypeTwo.equals(EntityType.ENTITY) && entityTypeOne.equals(EntityType.RECOMMENDATION);
}
public void addEntitiesIgnoreRank(Set<Entity> entities, Set<Entity> found) {
// HashSet keeps old value but we want the new.
entities.removeAll(found);