diff --git a/spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotationCollectors.java b/spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotationCollectors.java index 4efb5cb6064..d09369f9165 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotationCollectors.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotationCollectors.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package org.springframework.core.annotation; import java.lang.annotation.Annotation; import java.util.ArrayList; +import java.util.Collection; import java.util.LinkedHashSet; -import java.util.List; import java.util.Set; import java.util.function.Function; import java.util.function.IntFunction; @@ -31,10 +31,11 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; /** - * Collector implementations that provide various reduction operations for + * {@link Collector} implementations that provide various reduction operations for * {@link MergedAnnotation} instances. * * @author Phillip Webb + * @author Sam Brannen * @since 5.2 */ public abstract class MergedAnnotationCollectors { @@ -52,13 +53,16 @@ public abstract class MergedAnnotationCollectors { * Create a new {@link Collector} that accumulates merged annotations to a * {@link LinkedHashSet} containing {@linkplain MergedAnnotation#synthesize() * synthesized} versions. + *
The collector returned by this method is effectively equivalent to
+ * {@code Collectors.mapping(MergedAnnotation::synthesize, Collectors.toCollection(LinkedHashSet::new))}
+ * but avoids the creation of a composite collector.
* @param the annotation type
* @return a {@link Collector} which collects and synthesizes the
* annotations into a {@link Set}
*/
public static Collector This method is only invoked if the {@link java.util.stream.Stream} is
+ * processed in {@linkplain java.util.stream.Stream#parallel() parallel}.
+ */
+ private static This method is only invoked if the {@link java.util.stream.Stream} is
+ * processed in {@linkplain java.util.stream.Stream#parallel() parallel}.
+ */
+ private static