From 220be74e6c481166ff49c51f03e309e656d2851b Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Fri, 20 Dec 2024 13:11:27 +0200 Subject: [PATCH] Replace streams with for loop in customizers handling (#1274) This isn't going to make any difference in real life, but it does at least make stacktraces look a little better to look at (when an exception is thrown or in a flamegraph) Theoretically this change does change the semantics slightly as the customizers array is now sorted, but these customizers are private, so it shouldn't matter --- .../io/smallrye/config/SmallRyeConfigBuilder.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/implementation/src/main/java/io/smallrye/config/SmallRyeConfigBuilder.java b/implementation/src/main/java/io/smallrye/config/SmallRyeConfigBuilder.java index 5b312714f..00cc5870e 100644 --- a/implementation/src/main/java/io/smallrye/config/SmallRyeConfigBuilder.java +++ b/implementation/src/main/java/io/smallrye/config/SmallRyeConfigBuilder.java @@ -760,9 +760,15 @@ public SmallRyeConfig build() { } } - customizers.stream() - .sorted(Comparator.comparingInt(SmallRyeConfigBuilderCustomizer::priority)) - .forEach(customizer -> customizer.configBuilder(SmallRyeConfigBuilder.this)); + customizers.sort(new Comparator<>() { + @Override + public int compare(SmallRyeConfigBuilderCustomizer o1, SmallRyeConfigBuilderCustomizer o2) { + return o1.priority() - o2.priority(); + } + }); + for (SmallRyeConfigBuilderCustomizer customizer : customizers) { + customizer.configBuilder(this); + } return new SmallRyeConfig(this); }