private static <V> List<Routed<V>> getRouteCandidates(RoutingContext routingCtx, List<V> values,
                                                          Function<V, Route> routeResolver,
                                                          boolean isRouteDecorator) {
        ImmutableList.Builder<Routed<V>> builder = null;
        int remaining = values.size();

        for (V value : values) {
            final Route route = routeResolver.apply(value);
            final RoutingResult routingResult = route.apply(routingCtx, isRouteDecorator);
            if (routingResult.isPresent()) {
                if (builder == null) {
                    builder = ImmutableList.builderWithExpectedSize(remaining);
                }
                builder.add(Routed.of(route, routingResult, value));
            }
            remaining--;
        }
        return builder != null ? builder.build() : ImmutableList.of();
    }
Finds the most suitable service from the given {@link ServiceConfig} list.
core/src/main/java/com/linecorp/armeria/server/Routers.java