diff options
author | Matteo Mara <matteo.mara@sonarsource.com> | 2023-01-10 15:16:50 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-01-10 20:03:01 +0000 |
commit | 54b60b1adac5b703398163ee5edf5a621efc0d24 (patch) | |
tree | 2c4595fea6ddefca2b5f33cc9c26000ffb5750ce /server/sonar-ce/src | |
parent | 295a87208f8c9898fbdc733a438587dc03a16877 (diff) | |
download | sonarqube-54b60b1adac5b703398163ee5edf5a621efc0d24.tar.gz sonarqube-54b60b1adac5b703398163ee5edf5a621efc0d24.zip |
[NO-JIRA] Remove reported code smells about usages of toList
Diffstat (limited to 'server/sonar-ce/src')
-rw-r--r-- | server/sonar-ce/src/main/java/org/sonar/ce/monitoring/CeTasksMBeanImpl.java | 5 | ||||
-rw-r--r-- | server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/monitoring/CeTasksMBeanImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/monitoring/CeTasksMBeanImpl.java index cac5d41570d..e8ff259765d 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/monitoring/CeTasksMBeanImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/monitoring/CeTasksMBeanImpl.java @@ -21,7 +21,6 @@ package org.sonar.ce.monitoring; import java.util.List; import java.util.Set; -import java.util.stream.Collectors; import org.sonar.api.Startable; import org.sonar.ce.configuration.CeConfiguration; import org.sonar.ce.taskprocessor.CeWorker; @@ -103,7 +102,7 @@ public class CeTasksMBeanImpl implements CeTasksMBean, Startable, SystemInfoSect return workers.stream() .map(CeWorker::getUUID) .sorted() - .collect(Collectors.toList()); + .toList(); } @Override @@ -113,7 +112,7 @@ public class CeTasksMBeanImpl implements CeTasksMBean, Startable, SystemInfoSect .filter(ceWorkerController::isEnabled) .map(CeWorker::getUUID) .sorted() - .collect(Collectors.toList()); + .toList(); } @Override diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java b/server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java index 0a4f53ea1a0..4bd038ece4f 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java @@ -110,7 +110,7 @@ public class NextPendingTaskPicker { private static List<PrOrBranchTask> filterOldestPerProject(List<PrOrBranchTask> queuedPrOrBranches) { Set<String> mainComponentUuidsSeen = new HashSet<>(); - return queuedPrOrBranches.stream().filter(t -> mainComponentUuidsSeen.add(t.getMainComponentUuid())).collect(toList()); + return queuedPrOrBranches.stream().filter(t -> mainComponentUuidsSeen.add(t.getMainComponentUuid())).toList(); } /** @@ -124,7 +124,7 @@ public class NextPendingTaskPicker { String mainComponentUuid = task.getMainComponentUuid(); List<PrOrBranchTask> sameComponentTasks = inProgress.stream() .filter(t -> t.getMainComponentUuid().equals(mainComponentUuid)) - .collect(toList()); + .toList(); //we can peek branch analysis task only if all the other in progress tasks for this component uuid are pull requests return sameComponentTasks.stream().map(PrOrBranchTask::getBranchType).allMatch(s -> Objects.equals(s, PULL_REQUEST)); } |