diff options
author | Pierre <pierre.guillot@sonarsource.com> | 2023-07-10 16:59:50 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-07-17 20:03:45 +0000 |
commit | ce0e4ddf7ec619dde2c6cf02ae0ec08012f47335 (patch) | |
tree | 2f32948edd74d54872a7ec53c07fb1289e88a34a /server/sonar-ce-common | |
parent | 46ac0043ee3aedee6b2304969533847781d985ef (diff) | |
download | sonarqube-ce0e4ddf7ec619dde2c6cf02ae0ec08012f47335.tar.gz sonarqube-ce0e4ddf7ec619dde2c6cf02ae0ec08012f47335.zip |
NO-JIRA replace guava copy uniqueIndex to Collectors.toMap and simplify lambdas
Diffstat (limited to 'server/sonar-ce-common')
-rw-r--r-- | server/sonar-ce-common/src/main/java/org/sonar/ce/queue/CeQueueImpl.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/sonar-ce-common/src/main/java/org/sonar/ce/queue/CeQueueImpl.java b/server/sonar-ce-common/src/main/java/org/sonar/ce/queue/CeQueueImpl.java index 22a22cd7645..99c7cfdbd0a 100644 --- a/server/sonar-ce-common/src/main/java/org/sonar/ce/queue/CeQueueImpl.java +++ b/server/sonar-ce-common/src/main/java/org/sonar/ce/queue/CeQueueImpl.java @@ -30,6 +30,7 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; +import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Collectors; import javax.annotation.CheckForNull; @@ -57,7 +58,6 @@ import static com.google.common.base.Preconditions.checkState; import static java.util.Collections.singleton; import static java.util.Optional.ofNullable; import static org.sonar.ce.queue.CeQueue.SubmitOption.UNIQUE_QUEUE_PER_ENTITY; -import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex; import static org.sonar.db.ce.CeQueueDto.Status.IN_PROGRESS; import static org.sonar.db.ce.CeQueueDto.Status.PENDING; @@ -228,7 +228,7 @@ public class CeQueueImpl implements CeQueue { // these components correspond to a branch or a portfolio (analysis target) Map<String, ComponentDto> componentsByUuid = dbClient.componentDao() .selectByUuids(dbSession, componentUuids).stream() - .collect(uniqueIndex(ComponentDto::uuid)); + .collect(Collectors.toMap(ComponentDto::uuid, Function.identity())); Set<String> entityUuids = dtos.stream().map(CeQueueDto::getEntityUuid).filter(Objects::nonNull).collect(Collectors.toSet()); Map<String, EntityDto> entitiesByUuid = dbClient.entityDao().selectByUuids(dbSession, entityUuids).stream() .collect(Collectors.toMap(EntityDto::getUuid, e -> e)); @@ -249,7 +249,7 @@ public class CeQueueImpl implements CeQueue { .map(entitiesByUuid::get) .orElse(null); Map<String, String> characteristics = characteristicsByTaskUuid.get(dto.getUuid()).stream() - .collect(uniqueIndex(CeTaskCharacteristicDto::getKey, CeTaskCharacteristicDto::getValue)); + .collect(Collectors.toMap(CeTaskCharacteristicDto::getKey, CeTaskCharacteristicDto::getValue)); result.add(convertToTask(dbSession, dto, characteristics, component, entity)); } return result; |