pzygielo commented on code in PR #2254: URL: https://github.com/apache/maven/pull/2254#discussion_r2041128936
########## impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/cisupport/CIDetectorHelper.java: ########## @@ -33,15 +33,13 @@ public final class CIDetectorHelper { private CIDetectorHelper() {} public static List<CIInfo> detectCI() { - List<CIDetector> detectors = ServiceLoader.load(CIDetector.class).stream() + List<CIInfo> result = new ArrayList<>(ServiceLoader.load(CIDetector.class).stream() .map(ServiceLoader.Provider::get) - .toList(); + .map(CIDetector::detectCI) + .filter(Optional::isPresent) + .map(Optional::get) + .toList()); Review Comment: https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/stream/Stream.html#toList(): > The returned List is unmodifiable so not sure about `removeIf` later. Maybe `Collectors.toCollection(ArrayList::new)`? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org