@VisibleForTesting
    static Set<MethodInfo> mergeEndpoints(Iterable<MethodInfo> methodInfos) {
        final Map<String, MethodInfo> methodInfoMap = new HashMap<>();
        for (MethodInfo methodInfo : methodInfos) {
            methodInfoMap.compute(methodInfo.id(), (key, value) -> {
                if (value == null) {
                    return methodInfo;
                }
                final Set<EndpointInfo> endpointInfos =
                        Sets.union(value.endpoints(), methodInfo.endpoints());
                return new MethodInfo(value.name(), value.returnTypeSignature(), value.parameters(),
                                      value.useParameterAsRoot(), value.exceptionTypeSignatures(),
                                      endpointInfos, value.exampleHeaders(),
                                      value.exampleRequests(), value.examplePaths(), value.exampleQueries(),
                                      value.httpMethod(), value.descriptionInfo(), value.id());
            });
        }
        return ImmutableSortedSet
                .orderedBy(comparing(MethodInfo::name).thenComparing(MethodInfo::httpMethod)
                                                      .thenComparing(MethodInfo::id))
                .addAll(methodInfoMap.values())
                .build();
    }
Merges the {@link MethodInfo}s with the same method {@link MethodInfo#id()}
into a single {@link MethodInfo}. Note that only the {@link EndpointInfo}s are merged
because the {@link MethodInfo}s being merged always have the same
{@code exampleHeaders} and {@code exampleRequests}.
core/src/main/java/com/linecorp/armeria/server/docs/ServiceInfo.java