RED-6411 - optimize method

This commit is contained in:
Thomas Beyer 2023-03-28 11:28:43 +02:00
parent 4e76c007b8
commit 710747d00b

View File

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