You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2024/05/02 14:34:40 UTC
(camel) 06/07: Reduce complexity
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit f0cbc2eb246d4b0edb0c646da9e5d91da7980e4c
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Apr 26 13:55:00 2024 +0200
Reduce complexity
---
.../org/apache/camel/impl/console/RouteDevConsole.java | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/core/camel-console/src/main/java/org/apache/camel/impl/console/RouteDevConsole.java b/core/camel-console/src/main/java/org/apache/camel/impl/console/RouteDevConsole.java
index a6cb3354b04..27ad2f51fe4 100644
--- a/core/camel-console/src/main/java/org/apache/camel/impl/console/RouteDevConsole.java
+++ b/core/camel-console/src/main/java/org/apache/camel/impl/console/RouteDevConsole.java
@@ -301,16 +301,11 @@ public class RouteDevConsole extends AbstractDevConsole {
return;
}
- // sort by index
- List<ManagedProcessorMBean> mps = new ArrayList<>();
- for (String id : ids) {
- ManagedProcessorMBean mp = mcc.getManagedProcessor(id);
- if (mp != null) {
- mps.add(mp);
- }
- }
- // sort processors by index
- mps.sort(Comparator.comparingInt(ManagedProcessorMBean::getIndex));
+ List<ManagedProcessorMBean> mps = ids.stream().map(mcc::getManagedProcessor)
+ .filter(Objects::nonNull)
+ // sort processors by index
+ .sorted(Comparator.comparingInt(ManagedProcessorMBean::getIndex))
+ .toList();
for (ManagedProcessorMBean mp : mps) {
JsonObject jo = new JsonObject();