Skip to content

Commit

Permalink
Merge pull request #25550 from geoand/runtime-lambdas
Browse files Browse the repository at this point in the history
Get rid of a lambda in config runtime code
  • Loading branch information
geoand authored May 13, 2022
2 parents 292d89d + 7e7459a commit 48f5aae
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public OptionalInt getPriority() {

@SuppressWarnings("unchecked")
public static SmallRyeConfigBuilder configBuilder(SmallRyeConfigBuilder builder, List<ConfigBuilder> configBuilders) {
configBuilders.sort(Comparator.comparing(ConfigBuilder::priority));
configBuilders.sort(ConfigBuilderComparator.INSTANCE);

for (ConfigBuilder configBuilder : configBuilders) {
builder = configBuilder.configBuilder(builder);
Expand Down Expand Up @@ -333,4 +333,17 @@ public Set<String> getPropertyNames() {
return Collections.emptySet();
}
}

private static class ConfigBuilderComparator implements Comparator<ConfigBuilder> {

private static final ConfigBuilderComparator INSTANCE = new ConfigBuilderComparator();

private ConfigBuilderComparator() {
}

@Override
public int compare(ConfigBuilder o1, ConfigBuilder o2) {
return Integer.compare(o1.priority(), o2.priority());
}
}
}

0 comments on commit 48f5aae

Please sign in to comment.