Replace Collectors.toList with Stream.toList
Closes gh-29203
This commit is contained in:
parent
9d263668d5
commit
0ccb64fe10
|
|
@ -2020,7 +2020,7 @@ class DefaultListableBeanFactoryTests {
|
||||||
lbf.setParentBeanFactory(parentBf);
|
lbf.setParentBeanFactory(parentBf);
|
||||||
lbf.registerBeanDefinition("low", new RootBeanDefinition(LowPriorityTestBean.class));
|
lbf.registerBeanDefinition("low", new RootBeanDefinition(LowPriorityTestBean.class));
|
||||||
List<Class<?>> orderedTypes = lbf.getBeanProvider(TestBean.class).orderedStream()
|
List<Class<?>> orderedTypes = lbf.getBeanProvider(TestBean.class).orderedStream()
|
||||||
.map(Object::getClass).collect(Collectors.toList());
|
.map(Object::getClass).toList();
|
||||||
assertThat(orderedTypes).containsExactly(
|
assertThat(orderedTypes).containsExactly(
|
||||||
HighPriorityTestBean.class, LowPriorityTestBean.class, TestBean.class);
|
HighPriorityTestBean.class, LowPriorityTestBean.class, TestBean.class);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ import java.util.Set;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
@ -3016,11 +3015,11 @@ public class AutowiredAnnotationBeanPostProcessorTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TestBean> streamTestBeans() {
|
public List<TestBean> streamTestBeans() {
|
||||||
return this.testBeanProvider.stream().collect(Collectors.toList());
|
return this.testBeanProvider.stream().toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TestBean> sortedTestBeans() {
|
public List<TestBean> sortedTestBeans() {
|
||||||
return this.testBeanProvider.orderedStream().collect(Collectors.toList());
|
return this.testBeanProvider.orderedStream().toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -883,12 +883,12 @@ class BeanFactoryGenericsTests {
|
||||||
assertThat(resolved.get(0)).isSameAs(bf.getBean("store1"));
|
assertThat(resolved.get(0)).isSameAs(bf.getBean("store1"));
|
||||||
assertThat(resolved.get(1)).isSameAs(bf.getBean("store2"));
|
assertThat(resolved.get(1)).isSameAs(bf.getBean("store2"));
|
||||||
|
|
||||||
resolved = numberStoreProvider.stream().collect(Collectors.toList());
|
resolved = numberStoreProvider.stream().toList();
|
||||||
assertThat(resolved.size()).isEqualTo(2);
|
assertThat(resolved.size()).isEqualTo(2);
|
||||||
assertThat(resolved.get(0)).isSameAs(bf.getBean("store1"));
|
assertThat(resolved.get(0)).isSameAs(bf.getBean("store1"));
|
||||||
assertThat(resolved.get(1)).isSameAs(bf.getBean("store2"));
|
assertThat(resolved.get(1)).isSameAs(bf.getBean("store2"));
|
||||||
|
|
||||||
resolved = numberStoreProvider.orderedStream().collect(Collectors.toList());
|
resolved = numberStoreProvider.orderedStream().toList();
|
||||||
assertThat(resolved.size()).isEqualTo(2);
|
assertThat(resolved.size()).isEqualTo(2);
|
||||||
assertThat(resolved.get(0)).isSameAs(bf.getBean("store2"));
|
assertThat(resolved.get(0)).isSameAs(bf.getBean("store2"));
|
||||||
assertThat(resolved.get(1)).isSameAs(bf.getBean("store1"));
|
assertThat(resolved.get(1)).isSameAs(bf.getBean("store1"));
|
||||||
|
|
@ -938,7 +938,7 @@ class BeanFactoryGenericsTests {
|
||||||
bf.registerBeanDefinition("store2", bd2);
|
bf.registerBeanDefinition("store2", bd2);
|
||||||
|
|
||||||
ObjectProvider<NumberStore<?>> numberStoreProvider = bf.getBeanProvider(ResolvableType.forClass(NumberStore.class));
|
ObjectProvider<NumberStore<?>> numberStoreProvider = bf.getBeanProvider(ResolvableType.forClass(NumberStore.class));
|
||||||
List<NumberStore<?>> resolved = numberStoreProvider.orderedStream().collect(Collectors.toList());
|
List<NumberStore<?>> resolved = numberStoreProvider.orderedStream().toList();
|
||||||
assertThat(resolved.size()).isEqualTo(2);
|
assertThat(resolved.size()).isEqualTo(2);
|
||||||
assertThat(resolved.get(0)).isSameAs(bf.getBean("store2"));
|
assertThat(resolved.get(0)).isSameAs(bf.getBean("store2"));
|
||||||
assertThat(resolved.get(1)).isSameAs(bf.getBean("store1"));
|
assertThat(resolved.get(1)).isSameAs(bf.getBean("store1"));
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package org.springframework.context.index.processor;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.assertj.core.api.Condition;
|
import org.assertj.core.api.Condition;
|
||||||
|
|
||||||
|
|
@ -30,7 +29,7 @@ import org.assertj.core.api.Condition;
|
||||||
class Metadata {
|
class Metadata {
|
||||||
|
|
||||||
public static Condition<CandidateComponentsMetadata> of(Class<?> type, Class<?>... stereotypes) {
|
public static Condition<CandidateComponentsMetadata> of(Class<?> type, Class<?>... stereotypes) {
|
||||||
return of(type.getName(), Arrays.stream(stereotypes).map(Class::getName).collect(Collectors.toList()));
|
return of(type.getName(), Arrays.stream(stereotypes).map(Class::getName).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Condition<CandidateComponentsMetadata> of(String type, String... stereotypes) {
|
public static Condition<CandidateComponentsMetadata> of(String type, String... stereotypes) {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ package org.springframework.cache.annotation;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.ObjectProvider;
|
import org.springframework.beans.factory.ObjectProvider;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -77,7 +76,7 @@ public abstract class AbstractCachingConfiguration implements ImportAware {
|
||||||
@Autowired
|
@Autowired
|
||||||
void setConfigurers(ObjectProvider<CachingConfigurer> configurers) {
|
void setConfigurers(ObjectProvider<CachingConfigurer> configurers) {
|
||||||
Supplier<CachingConfigurer> configurer = () -> {
|
Supplier<CachingConfigurer> configurer = () -> {
|
||||||
List<CachingConfigurer> candidates = configurers.stream().collect(Collectors.toList());
|
List<CachingConfigurer> candidates = configurers.stream().toList();
|
||||||
if (CollectionUtils.isEmpty(candidates)) {
|
if (CollectionUtils.isEmpty(candidates)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import java.util.List;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
|
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
|
||||||
import org.springframework.beans.factory.ObjectProvider;
|
import org.springframework.beans.factory.ObjectProvider;
|
||||||
|
|
@ -72,7 +71,7 @@ public abstract class AbstractAsyncConfiguration implements ImportAware {
|
||||||
@Autowired
|
@Autowired
|
||||||
void setConfigurers(ObjectProvider<AsyncConfigurer> configurers) {
|
void setConfigurers(ObjectProvider<AsyncConfigurer> configurers) {
|
||||||
Supplier<AsyncConfigurer> configurer = SingletonSupplier.of(() -> {
|
Supplier<AsyncConfigurer> configurer = SingletonSupplier.of(() -> {
|
||||||
List<AsyncConfigurer> candidates = configurers.stream().collect(Collectors.toList());
|
List<AsyncConfigurer> candidates = configurers.stream().toList();
|
||||||
if (CollectionUtils.isEmpty(candidates)) {
|
if (CollectionUtils.isEmpty(candidates)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package org.springframework.context.annotation;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
|
@ -156,7 +155,7 @@ class ConfigurationClassAndBeanMethodTests {
|
||||||
private static List<BeanMethod> getBeanMethods(ConfigurationClass configurationClass) {
|
private static List<BeanMethod> getBeanMethods(ConfigurationClass configurationClass) {
|
||||||
List<BeanMethod> beanMethods = configurationClass.getBeanMethods().stream()
|
List<BeanMethod> beanMethods = configurationClass.getBeanMethods().stream()
|
||||||
.sorted(Comparator.comparing(beanMethod -> beanMethod.getMetadata().getMethodName()))
|
.sorted(Comparator.comparing(beanMethod -> beanMethod.getMetadata().getMethodName()))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
assertThat(beanMethods).hasSize(3);
|
assertThat(beanMethods).hasSize(3);
|
||||||
return beanMethods;
|
return beanMethods;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.springframework.context.index.CandidateComponentsIndexLoader;
|
import org.springframework.context.index.CandidateComponentsIndexLoader;
|
||||||
|
|
@ -63,7 +62,7 @@ public class CandidateComponentsTestClassLoader extends ClassLoader {
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
throw new IllegalArgumentException("Invalid resource " + r, ex);
|
throw new IllegalArgumentException("Invalid resource " + r, ex);
|
||||||
}
|
}
|
||||||
}).collect(Collectors.toList())));
|
}).toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package org.springframework.aot.agent;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.springframework.aot.hint.RuntimeHints;
|
import org.springframework.aot.hint.RuntimeHints;
|
||||||
|
|
@ -153,7 +152,7 @@ public final class RecordedInvocation {
|
||||||
* @return the argument types, starting at the given index
|
* @return the argument types, starting at the given index
|
||||||
*/
|
*/
|
||||||
public List<TypeReference> getArgumentTypes(int index) {
|
public List<TypeReference> getArgumentTypes(int index) {
|
||||||
return Arrays.stream(this.arguments).skip(index).map(param -> TypeReference.of(param.getClass())).collect(Collectors.toList());
|
return Arrays.stream(this.arguments).skip(index).map(param -> TypeReference.of(param.getClass())).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -259,7 +258,7 @@ public final class RecordedInvocation {
|
||||||
public RecordedInvocation build() {
|
public RecordedInvocation build() {
|
||||||
List<StackWalker.StackFrame> stackFrames = StackWalker.getInstance().walk(stream -> stream
|
List<StackWalker.StackFrame> stackFrames = StackWalker.getInstance().walk(stream -> stream
|
||||||
.dropWhile(stackFrame -> stackFrame.getClassName().startsWith(getClass().getPackageName()))
|
.dropWhile(stackFrame -> stackFrame.getClassName().startsWith(getClass().getPackageName()))
|
||||||
.collect(Collectors.toList()));
|
.toList());
|
||||||
return new RecordedInvocation(this.instrumentedMethod, this.instance, this.arguments, this.returnValue, stackFrames);
|
return new RecordedInvocation(this.instrumentedMethod, this.instance, this.arguments, this.returnValue, stackFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public class GenericConversionServiceBenchmark {
|
||||||
|
|
||||||
@Setup(Level.Trial)
|
@Setup(Level.Trial)
|
||||||
public void setup() throws Exception {
|
public void setup() throws Exception {
|
||||||
this.source = IntStream.rangeClosed(1, collectionSize).mapToObj(String::valueOf).collect(Collectors.toList());
|
this.source = IntStream.rangeClosed(1, collectionSize).mapToObj(String::valueOf).toList();
|
||||||
List<Integer> target = new ArrayList<>();
|
List<Integer> target = new ArrayList<>();
|
||||||
this.targetTypeDesc = TypeDescriptor.forObject(target);
|
this.targetTypeDesc = TypeDescriptor.forObject(target);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ package org.springframework.core;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import kotlin.reflect.KFunction;
|
import kotlin.reflect.KFunction;
|
||||||
import kotlin.reflect.KParameter;
|
import kotlin.reflect.KParameter;
|
||||||
|
|
@ -77,7 +76,7 @@ public class KotlinReflectionParameterNameDiscoverer implements ParameterNameDis
|
||||||
.stream()
|
.stream()
|
||||||
// Extension receivers of extension methods must be included as they appear as normal method parameters in Java
|
// Extension receivers of extension methods must be included as they appear as normal method parameters in Java
|
||||||
.filter(p -> KParameter.Kind.VALUE.equals(p.getKind()) || KParameter.Kind.EXTENSION_RECEIVER.equals(p.getKind()))
|
.filter(p -> KParameter.Kind.VALUE.equals(p.getKind()) || KParameter.Kind.EXTENSION_RECEIVER.equals(p.getKind()))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
String[] parameterNames = new String[filteredParameters.size()];
|
String[] parameterNames = new String[filteredParameters.size()];
|
||||||
for (int i = 0; i < filteredParameters.size(); i++) {
|
for (int i = 0; i < filteredParameters.size(); i++) {
|
||||||
KParameter parameter = filteredParameters.get(i);
|
KParameter parameter = filteredParameters.get(i);
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.function.BiPredicate;
|
import java.util.function.BiPredicate;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
|
|
@ -292,7 +291,7 @@ public abstract class MimeTypeUtils {
|
||||||
return tokenize(mimeTypes).stream()
|
return tokenize(mimeTypes).stream()
|
||||||
.filter(StringUtils::hasText)
|
.filter(StringUtils::hasText)
|
||||||
.map(MimeTypeUtils::parseMimeType)
|
.map(MimeTypeUtils::parseMimeType)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import java.lang.annotation.RetentionPolicy;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
|
@ -95,7 +94,7 @@ class MergedAnnotationPredicatesTests {
|
||||||
List<MergedAnnotation<TestAnnotation>> filtered = MergedAnnotations.from(
|
List<MergedAnnotation<TestAnnotation>> filtered = MergedAnnotations.from(
|
||||||
WithMultipleTestAnnotation.class).stream(TestAnnotation.class).filter(
|
WithMultipleTestAnnotation.class).stream(TestAnnotation.class).filter(
|
||||||
MergedAnnotationPredicates.firstRunOf(
|
MergedAnnotationPredicates.firstRunOf(
|
||||||
this::firstCharOfValue)).collect(Collectors.toList());
|
this::firstCharOfValue)).toList();
|
||||||
assertThat(filtered.stream().map(
|
assertThat(filtered.stream().map(
|
||||||
annotation -> annotation.getString("value"))).containsExactly("a1", "a2", "a3");
|
annotation -> annotation.getString("value"))).containsExactly("a1", "a2", "a3");
|
||||||
}
|
}
|
||||||
|
|
@ -111,7 +110,7 @@ class MergedAnnotationPredicatesTests {
|
||||||
List<MergedAnnotation<TestAnnotation>> filtered = MergedAnnotations.from(
|
List<MergedAnnotation<TestAnnotation>> filtered = MergedAnnotations.from(
|
||||||
WithMultipleTestAnnotation.class).stream(TestAnnotation.class).filter(
|
WithMultipleTestAnnotation.class).stream(TestAnnotation.class).filter(
|
||||||
MergedAnnotationPredicates.unique(
|
MergedAnnotationPredicates.unique(
|
||||||
this::firstCharOfValue)).collect(Collectors.toList());
|
this::firstCharOfValue)).toList();
|
||||||
assertThat(filtered.stream().map(
|
assertThat(filtered.stream().map(
|
||||||
annotation -> annotation.getString("value"))).containsExactly("a1", "b1", "c1");
|
annotation -> annotation.getString("value"))).containsExactly("a1", "b1", "c1");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
|
@ -1896,7 +1895,7 @@ class MergedAnnotationsTests {
|
||||||
Adapt.ANNOTATION_TO_MAP);
|
Adapt.ANNOTATION_TO_MAP);
|
||||||
Map<String, Object>[] filters = (Map[]) map.get("excludeFilters");
|
Map<String, Object>[] filters = (Map[]) map.get("excludeFilters");
|
||||||
List<String> patterns = Arrays.stream(filters).map(
|
List<String> patterns = Arrays.stream(filters).map(
|
||||||
m -> (String) m.get("pattern")).collect(Collectors.toList());
|
m -> (String) m.get("pattern")).toList();
|
||||||
assertThat(patterns).containsExactly("*Foo", "*Bar");
|
assertThat(patterns).containsExactly("*Foo", "*Bar");
|
||||||
filters[0].put("pattern", "newFoo");
|
filters[0].put("pattern", "newFoo");
|
||||||
filters[0].put("enigma", 42);
|
filters[0].put("enigma", 42);
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import io.netty.buffer.PooledByteBufAllocator;
|
import io.netty.buffer.PooledByteBufAllocator;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
@ -140,7 +139,7 @@ public class LeakAwareDataBufferFactory implements DataBufferFactory {
|
||||||
// Remove LeakAwareDataBuffer wrapper so delegate can find native buffers
|
// Remove LeakAwareDataBuffer wrapper so delegate can find native buffers
|
||||||
dataBuffers = dataBuffers.stream()
|
dataBuffers = dataBuffers.stream()
|
||||||
.map(o -> o instanceof LeakAwareDataBuffer ? ((LeakAwareDataBuffer) o).dataBuffer() : o)
|
.map(o -> o instanceof LeakAwareDataBuffer ? ((LeakAwareDataBuffer) o).dataBuffer() : o)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
return new LeakAwareDataBuffer(this.delegate.join(dataBuffers), this);
|
return new LeakAwareDataBuffer(this.delegate.join(dataBuffers), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
@ -88,7 +87,7 @@ public abstract class TestPropertySourceUtils {
|
||||||
// Convert all the merged annotations for the current aggregate
|
// Convert all the merged annotations for the current aggregate
|
||||||
// level to a list of TestPropertySourceAttributes.
|
// level to a list of TestPropertySourceAttributes.
|
||||||
List<TestPropertySourceAttributes> aggregatedAttributesList =
|
List<TestPropertySourceAttributes> aggregatedAttributesList =
|
||||||
aggregatedAnnotations.stream().map(TestPropertySourceAttributes::new).collect(Collectors.toList());
|
aggregatedAnnotations.stream().map(TestPropertySourceAttributes::new).toList();
|
||||||
// Merge all TestPropertySourceAttributes instances for the current
|
// Merge all TestPropertySourceAttributes instances for the current
|
||||||
// aggregate level into a single TestPropertySourceAttributes instance.
|
// aggregate level into a single TestPropertySourceAttributes instance.
|
||||||
TestPropertySourceAttributes mergedAttributes = mergeTestPropertySourceAttributes(aggregatedAttributesList);
|
TestPropertySourceAttributes mergedAttributes = mergeTestPropertySourceAttributes(aggregatedAttributesList);
|
||||||
|
|
|
||||||
|
|
@ -486,7 +486,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
|
||||||
range.getWeight() == Locale.LanguageRange.MAX_WEIGHT ?
|
range.getWeight() == Locale.LanguageRange.MAX_WEIGHT ?
|
||||||
range.getRange() :
|
range.getRange() :
|
||||||
range.getRange() + ";q=" + decimal.format(range.getWeight()))
|
range.getRange() + ";q=" + decimal.format(range.getWeight()))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
set(ACCEPT_LANGUAGE, toCommaDelimitedString(values));
|
set(ACCEPT_LANGUAGE, toCommaDelimitedString(values));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -511,7 +511,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
|
||||||
public void setAcceptLanguageAsLocales(List<Locale> locales) {
|
public void setAcceptLanguageAsLocales(List<Locale> locales) {
|
||||||
setAcceptLanguage(locales.stream()
|
setAcceptLanguage(locales.stream()
|
||||||
.map(locale -> new Locale.LanguageRange(locale.toLanguageTag()))
|
.map(locale -> new Locale.LanguageRange(locale.toLanguageTag()))
|
||||||
.collect(Collectors.toList()));
|
.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -529,7 +529,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
|
||||||
return ranges.stream()
|
return ranges.stream()
|
||||||
.map(range -> Locale.forLanguageTag(range.getRange()))
|
.map(range -> Locale.forLanguageTag(range.getRange()))
|
||||||
.filter(locale -> StringUtils.hasText(locale.getDisplayName()))
|
.filter(locale -> StringUtils.hasText(locale.getDisplayName()))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.reactivestreams.Publisher;
|
import org.reactivestreams.Publisher;
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
|
|
@ -149,7 +148,7 @@ public abstract class AbstractClientHttpRequest implements ClientHttpRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<? extends Publisher<Void>> actions = this.commitActions.stream()
|
List<? extends Publisher<Void>> actions = this.commitActions.stream()
|
||||||
.map(Supplier::get).collect(Collectors.toList());
|
.map(Supplier::get).toList();
|
||||||
|
|
||||||
return Flux.concat(actions).then();
|
return Flux.concat(actions).then();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.http.HttpField;
|
import org.eclipse.jetty.http.HttpField;
|
||||||
import org.eclipse.jetty.http.HttpFields;
|
import org.eclipse.jetty.http.HttpFields;
|
||||||
|
|
@ -177,7 +176,7 @@ class JettyHeadersAdapter implements MultiValueMap<String, String> {
|
||||||
@Override
|
@Override
|
||||||
public Collection<List<String>> values() {
|
public Collection<List<String>> values() {
|
||||||
return this.headers.getFieldNamesCollection().stream()
|
return this.headers.getFieldNamesCollection().stream()
|
||||||
.map(this.headers::getValuesList).collect(Collectors.toList());
|
.map(this.headers::getValuesList).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import io.netty5.handler.codec.http.HttpHeaders;
|
import io.netty5.handler.codec.http.HttpHeaders;
|
||||||
|
|
||||||
|
|
@ -165,7 +164,7 @@ class Netty5HeadersAdapter implements MultiValueMap<String, String> {
|
||||||
@Override
|
@Override
|
||||||
public Collection<List<String>> values() {
|
public Collection<List<String>> values() {
|
||||||
return this.headers.names().stream()
|
return this.headers.names().stream()
|
||||||
.map(this.headers::getAll).collect(Collectors.toList());
|
.map(this.headers::getAll).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import io.netty.handler.codec.http.HttpHeaders;
|
import io.netty.handler.codec.http.HttpHeaders;
|
||||||
|
|
||||||
|
|
@ -164,7 +163,7 @@ class NettyHeadersAdapter implements MultiValueMap<String, String> {
|
||||||
@Override
|
@Override
|
||||||
public Collection<List<String>> values() {
|
public Collection<List<String>> values() {
|
||||||
return this.headers.names().stream()
|
return this.headers.names().stream()
|
||||||
.map(this.headers::getAll).collect(Collectors.toList());
|
.map(this.headers::getAll).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
import org.reactivestreams.Publisher;
|
import org.reactivestreams.Publisher;
|
||||||
|
|
@ -61,7 +60,7 @@ public class ProtobufEncoder extends ProtobufCodecSupport implements HttpMessage
|
||||||
.stream()
|
.stream()
|
||||||
.map(mimeType -> new MediaType(mimeType.getType(), mimeType.getSubtype(),
|
.map(mimeType -> new MediaType(mimeType.getType(), mimeType.getSubtype(),
|
||||||
Collections.singletonMap(DELIMITED_KEY, DELIMITED_VALUE)))
|
Collections.singletonMap(DELIMITED_KEY, DELIMITED_VALUE)))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.http.HttpField;
|
import org.eclipse.jetty.http.HttpField;
|
||||||
import org.eclipse.jetty.http.HttpFields;
|
import org.eclipse.jetty.http.HttpFields;
|
||||||
|
|
@ -161,7 +160,7 @@ class JettyHeadersAdapter implements MultiValueMap<String, String> {
|
||||||
@Override
|
@Override
|
||||||
public Collection<List<String>> values() {
|
public Collection<List<String>> values() {
|
||||||
return this.headers.getFieldNamesCollection().stream()
|
return this.headers.getFieldNamesCollection().stream()
|
||||||
.map(this.headers::getValuesList).collect(Collectors.toList());
|
.map(this.headers::getValuesList).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import io.netty5.handler.codec.http.HttpHeaders;
|
import io.netty5.handler.codec.http.HttpHeaders;
|
||||||
|
|
||||||
|
|
@ -163,7 +162,7 @@ final class Netty5HeadersAdapter implements MultiValueMap<String, String> {
|
||||||
@Override
|
@Override
|
||||||
public Collection<List<String>> values() {
|
public Collection<List<String>> values() {
|
||||||
return this.headers.names().stream()
|
return this.headers.names().stream()
|
||||||
.map(this.headers::getAll).collect(Collectors.toList());
|
.map(this.headers::getAll).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import io.netty.handler.codec.http.HttpHeaders;
|
import io.netty.handler.codec.http.HttpHeaders;
|
||||||
|
|
||||||
|
|
@ -163,7 +162,7 @@ final class NettyHeadersAdapter implements MultiValueMap<String, String> {
|
||||||
@Override
|
@Override
|
||||||
public Collection<List<String>> values() {
|
public Collection<List<String>> values() {
|
||||||
return this.headers.names().stream()
|
return this.headers.names().stream()
|
||||||
.map(this.headers::getAll).collect(Collectors.toList());
|
.map(this.headers::getAll).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.apache.tomcat.util.buf.MessageBytes;
|
import org.apache.tomcat.util.buf.MessageBytes;
|
||||||
import org.apache.tomcat.util.http.MimeHeaders;
|
import org.apache.tomcat.util.http.MimeHeaders;
|
||||||
|
|
@ -172,7 +171,7 @@ class TomcatHeadersAdapter implements MultiValueMap<String, String> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<List<String>> values() {
|
public Collection<List<String>> values() {
|
||||||
return keySet().stream().map(this::get).collect(Collectors.toList());
|
return keySet().stream().map(this::get).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ package org.springframework.web.bind.support;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
|
@ -124,7 +123,7 @@ public class WebExchangeDataBinder extends WebDataBinder {
|
||||||
if (!CollectionUtils.isEmpty(values)) {
|
if (!CollectionUtils.isEmpty(values)) {
|
||||||
values = values.stream()
|
values = values.stream()
|
||||||
.map(value -> value instanceof FormFieldPart ? ((FormFieldPart) value).value() : value)
|
.map(value -> value instanceof FormFieldPart ? ((FormFieldPart) value).value() : value)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
params.put(key, values.size() == 1 ? values.get(0) : values);
|
params.put(key, values.size() == 1 ? values.get(0) : values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import io.micrometer.observation.Observation;
|
import io.micrometer.observation.Observation;
|
||||||
|
|
@ -971,7 +970,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||||
.filter(converter -> canReadResponse(this.responseType, converter))
|
.filter(converter -> canReadResponse(this.responseType, converter))
|
||||||
.flatMap((HttpMessageConverter<?> converter) -> getSupportedMediaTypes(this.responseType, converter))
|
.flatMap((HttpMessageConverter<?> converter) -> getSupportedMediaTypes(this.responseType, converter))
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
MimeTypeUtils.sortBySpecificity(allSupportedMediaTypes);
|
MimeTypeUtils.sortBySpecificity(allSupportedMediaTypes);
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("Accept=" + allSupportedMediaTypes);
|
logger.debug("Accept=" + allSupportedMediaTypes);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
|
@ -136,7 +135,7 @@ public class CorsConfiguration {
|
||||||
*/
|
*/
|
||||||
public void setAllowedOrigins(@Nullable List<String> origins) {
|
public void setAllowedOrigins(@Nullable List<String> origins) {
|
||||||
this.allowedOrigins = (origins == null ? null :
|
this.allowedOrigins = (origins == null ? null :
|
||||||
origins.stream().filter(Objects::nonNull).map(this::trimTrailingSlash).collect(Collectors.toList()));
|
origins.stream().filter(Objects::nonNull).map(this::trimTrailingSlash).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String trimTrailingSlash(String origin) {
|
private String trimTrailingSlash(String origin) {
|
||||||
|
|
@ -212,7 +211,7 @@ public class CorsConfiguration {
|
||||||
}
|
}
|
||||||
return this.allowedOriginPatterns.stream()
|
return this.allowedOriginPatterns.stream()
|
||||||
.map(OriginPattern::getDeclaredPattern)
|
.map(OriginPattern::getDeclaredPattern)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -445,7 +444,7 @@ public class CorsConfiguration {
|
||||||
if (this.allowedMethods == null) {
|
if (this.allowedMethods == null) {
|
||||||
this.allowedMethods = DEFAULT_PERMIT_METHODS;
|
this.allowedMethods = DEFAULT_PERMIT_METHODS;
|
||||||
this.resolvedMethods = DEFAULT_PERMIT_METHODS
|
this.resolvedMethods = DEFAULT_PERMIT_METHODS
|
||||||
.stream().map(HttpMethod::valueOf).collect(Collectors.toList());
|
.stream().map(HttpMethod::valueOf).toList();
|
||||||
}
|
}
|
||||||
if (this.allowedHeaders == null) {
|
if (this.allowedHeaders == null) {
|
||||||
this.allowedHeaders = DEFAULT_PERMIT_ALL;
|
this.allowedHeaders = DEFAULT_PERMIT_ALL;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import reactor.blockhound.BlockHound;
|
import reactor.blockhound.BlockHound;
|
||||||
import reactor.blockhound.integration.BlockHoundIntegration;
|
import reactor.blockhound.integration.BlockHoundIntegration;
|
||||||
|
|
@ -170,13 +169,13 @@ public final class WebHttpHandlerBuilder {
|
||||||
List<WebFilter> webFilters = context
|
List<WebFilter> webFilters = context
|
||||||
.getBeanProvider(WebFilter.class)
|
.getBeanProvider(WebFilter.class)
|
||||||
.orderedStream()
|
.orderedStream()
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
builder.filters(filters -> filters.addAll(webFilters));
|
builder.filters(filters -> filters.addAll(webFilters));
|
||||||
|
|
||||||
List<WebExceptionHandler> exceptionHandlers = context
|
List<WebExceptionHandler> exceptionHandlers = context
|
||||||
.getBeanProvider(WebExceptionHandler.class)
|
.getBeanProvider(WebExceptionHandler.class)
|
||||||
.orderedStream()
|
.orderedStream()
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
builder.exceptionHandlers(handlers -> handlers.addAll(exceptionHandlers));
|
builder.exceptionHandlers(handlers -> handlers.addAll(exceptionHandlers));
|
||||||
|
|
||||||
context.getBeanProvider(HttpHandlerDecoratorFactory.class)
|
context.getBeanProvider(HttpHandlerDecoratorFactory.class)
|
||||||
|
|
@ -253,7 +252,7 @@ public final class WebHttpHandlerBuilder {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.filter(filter -> !(filter instanceof ForwardedHeaderTransformer))
|
.filter(filter -> !(filter instanceof ForwardedHeaderTransformer))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
|
|
||||||
this.filters.clear();
|
this.filters.clear();
|
||||||
this.filters.addAll(filtersToUse);
|
this.filters.addAll(filtersToUse);
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import java.time.Duration;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.springframework.http.HttpCookie;
|
import org.springframework.http.HttpCookie;
|
||||||
import org.springframework.http.ResponseCookie;
|
import org.springframework.http.ResponseCookie;
|
||||||
|
|
@ -100,7 +99,7 @@ public class CookieWebSessionIdResolver implements WebSessionIdResolver {
|
||||||
if (cookies == null) {
|
if (cookies == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
return cookies.stream().map(HttpCookie::getValue).collect(Collectors.toList());
|
return cookies.stream().map(HttpCookie::getValue).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import okhttp3.mockwebserver.MockResponse;
|
import okhttp3.mockwebserver.MockResponse;
|
||||||
import okhttp3.mockwebserver.MockWebServer;
|
import okhttp3.mockwebserver.MockWebServer;
|
||||||
|
|
@ -523,7 +522,7 @@ class RestTemplateTests {
|
||||||
final List<List<String>> accepts = request.getHeaders().toMultimap().entrySet().stream()
|
final List<List<String>> accepts = request.getHeaders().toMultimap().entrySet().stream()
|
||||||
.filter(entry -> entry.getKey().equalsIgnoreCase("accept"))
|
.filter(entry -> entry.getKey().equalsIgnoreCase("accept"))
|
||||||
.map(Entry::getValue)
|
.map(Entry::getValue)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
|
|
||||||
assertThat(accepts).hasSize(1);
|
assertThat(accepts).hasSize(1);
|
||||||
assertThat(accepts.get(0)).hasSize(1);
|
assertThat(accepts.get(0)).hasSize(1);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
|
@ -88,7 +87,7 @@ public class RequestedContentTypeResolverBuilder {
|
||||||
*/
|
*/
|
||||||
public RequestedContentTypeResolver build() {
|
public RequestedContentTypeResolver build() {
|
||||||
List<RequestedContentTypeResolver> resolvers = (!this.candidates.isEmpty() ?
|
List<RequestedContentTypeResolver> resolvers = (!this.candidates.isEmpty() ?
|
||||||
this.candidates.stream().map(Supplier::get).collect(Collectors.toList()) :
|
this.candidates.stream().map(Supplier::get).toList() :
|
||||||
Collections.singletonList(new HeaderContentTypeResolver()));
|
Collections.singletonList(new HeaderContentTypeResolver()));
|
||||||
|
|
||||||
return exchange -> {
|
return exchange -> {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.springframework.format.FormatterRegistry;
|
import org.springframework.format.FormatterRegistry;
|
||||||
import org.springframework.http.codec.ServerCodecConfigurer;
|
import org.springframework.http.codec.ServerCodecConfigurer;
|
||||||
|
|
@ -109,7 +108,7 @@ public class WebFluxConfigurerComposite implements WebFluxConfigurer {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private <T> T createSingleBean(Function<WebFluxConfigurer, T> factory, Class<T> beanType) {
|
private <T> T createSingleBean(Function<WebFluxConfigurer, T> factory, Class<T> beanType) {
|
||||||
List<T> result = this.delegates.stream().map(factory).filter(Objects::nonNull).collect(Collectors.toList());
|
List<T> result = this.delegates.stream().map(factory).filter(Objects::nonNull).toList();
|
||||||
if (result.isEmpty()) {
|
if (result.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.reactivestreams.Publisher;
|
import org.reactivestreams.Publisher;
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
|
|
@ -203,7 +202,7 @@ public abstract class BodyExtractors {
|
||||||
.orElseGet(() -> {
|
.orElseGet(() -> {
|
||||||
List<MediaType> mediaTypes = context.messageReaders().stream()
|
List<MediaType> mediaTypes = context.messageReaders().stream()
|
||||||
.flatMap(reader -> reader.getReadableMediaTypes(elementType).stream())
|
.flatMap(reader -> reader.getReadableMediaTypes(elementType).stream())
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
return errorFunction.apply(
|
return errorFunction.apply(
|
||||||
new UnsupportedMediaTypeException(contentType, mediaTypes, elementType));
|
new UnsupportedMediaTypeException(contentType, mediaTypes, elementType));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
package org.springframework.web.reactive.function;
|
package org.springframework.web.reactive.function;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.reactivestreams.Publisher;
|
import org.reactivestreams.Publisher;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
@ -386,7 +385,7 @@ public abstract class BodyInserters {
|
||||||
|
|
||||||
List<MediaType> supportedMediaTypes = context.messageWriters().stream()
|
List<MediaType> supportedMediaTypes = context.messageWriters().stream()
|
||||||
.flatMap(reader -> reader.getWritableMediaTypes(bodyType).stream())
|
.flatMap(reader -> reader.getWritableMediaTypes(bodyType).stream())
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
|
|
||||||
return new UnsupportedMediaTypeException(mediaType, supportedMediaTypes, bodyType);
|
return new UnsupportedMediaTypeException(mediaType, supportedMediaTypes, bodyType);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import java.util.function.Function;
|
||||||
import java.util.function.IntPredicate;
|
import java.util.function.IntPredicate;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import io.micrometer.observation.Observation;
|
import io.micrometer.observation.Observation;
|
||||||
import io.micrometer.observation.ObservationRegistry;
|
import io.micrometer.observation.ObservationRegistry;
|
||||||
|
|
@ -122,7 +121,7 @@ class DefaultWebClient implements WebClient {
|
||||||
return (CollectionUtils.isEmpty(handlerMap) ? Collections.emptyList() :
|
return (CollectionUtils.isEmpty(handlerMap) ? Collections.emptyList() :
|
||||||
handlerMap.entrySet().stream()
|
handlerMap.entrySet().stream()
|
||||||
.map(entry -> new DefaultResponseSpec.StatusHandler(entry.getKey(), entry.getValue()))
|
.map(entry -> new DefaultResponseSpec.StatusHandler(entry.getKey(), entry.getValue()))
|
||||||
.collect(Collectors.toList()));
|
.toList());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
@ -359,7 +358,7 @@ public class ResourceWebHandler implements WebHandler, InitializingBean {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOptimizeLocations()) {
|
if (isOptimizeLocations()) {
|
||||||
result = result.stream().filter(Resource::exists).collect(Collectors.toList());
|
result = result.stream().filter(Resource::exists).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.locationsToUse.clear();
|
this.locationsToUse.clear();
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
|
||||||
return this.partialMatches.stream()
|
return this.partialMatches.stream()
|
||||||
.filter(PartialMatch::hasProducesMatch)
|
.filter(PartialMatch::hasProducesMatch)
|
||||||
.map(match -> match.getInfo().getParamsCondition().getExpressions())
|
.map(match -> match.getInfo().getParamsCondition().getExpressions())
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import java.lang.reflect.Method;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.springframework.core.DefaultParameterNameDiscoverer;
|
import org.springframework.core.DefaultParameterNameDiscoverer;
|
||||||
import org.springframework.core.ParameterNameDiscoverer;
|
import org.springframework.core.ParameterNameDiscoverer;
|
||||||
|
|
@ -69,7 +68,7 @@ public class SyncInvocableHandlerMethod extends HandlerMethod {
|
||||||
public List<SyncHandlerMethodArgumentResolver> getResolvers() {
|
public List<SyncHandlerMethodArgumentResolver> getResolvers() {
|
||||||
return this.delegate.getResolvers().stream()
|
return this.delegate.getResolvers().stream()
|
||||||
.map(resolver -> (SyncHandlerMethodArgumentResolver) resolver)
|
.map(resolver -> (SyncHandlerMethodArgumentResolver) resolver)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
@ -133,9 +132,9 @@ class ControllerMethodResolver {
|
||||||
ConfigurableApplicationContext context) {
|
ConfigurableApplicationContext context) {
|
||||||
|
|
||||||
return initResolvers(customResolvers, adapterRegistry, context, false, Collections.emptyList()).stream()
|
return initResolvers(customResolvers, adapterRegistry, context, false, Collections.emptyList()).stream()
|
||||||
.filter(resolver -> resolver instanceof SyncHandlerMethodArgumentResolver)
|
.filter(SyncHandlerMethodArgumentResolver.class::isInstance)
|
||||||
.map(resolver -> (SyncHandlerMethodArgumentResolver) resolver)
|
.map(SyncHandlerMethodArgumentResolver.class::cast)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<HandlerMethodArgumentResolver> modelMethodResolvers(
|
private static List<HandlerMethodArgumentResolver> modelMethodResolvers(
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
|
@ -112,7 +111,7 @@ class ModelInitializer {
|
||||||
.zip(resultList, objectArray ->
|
.zip(resultList, objectArray ->
|
||||||
Arrays.stream(objectArray)
|
Arrays.stream(objectArray)
|
||||||
.map(object -> handleResult(((HandlerResult) object), bindingContext))
|
.map(object -> handleResult(((HandlerResult) object), bindingContext))
|
||||||
.collect(Collectors.toList()))
|
.toList())
|
||||||
.flatMap(Mono::when);
|
.flatMap(Mono::when);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
@ -357,7 +356,7 @@ public class ViewResolutionResultHandler extends HandlerResultHandlerSupport imp
|
||||||
private List<MediaType> getMediaTypes(List<View> views) {
|
private List<MediaType> getMediaTypes(List<View> views) {
|
||||||
return views.stream()
|
return views.stream()
|
||||||
.flatMap(view -> view.getSupportedMediaTypes().stream())
|
.flatMap(view -> view.getSupportedMediaTypes().stream())
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package org.springframework.web.reactive.result.condition;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
|
@ -210,7 +209,7 @@ public class PatternsRequestConditionTests {
|
||||||
return new PatternsRequestCondition(Arrays
|
return new PatternsRequestCondition(Arrays
|
||||||
.stream(patterns)
|
.stream(patterns)
|
||||||
.map(this.parser::parse)
|
.map(this.parser::parse)
|
||||||
.collect(Collectors.toList()));
|
.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import java.time.Duration;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import io.reactivex.rxjava3.core.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
@ -208,7 +207,7 @@ public class ModelInitializerTests {
|
||||||
MethodIntrospector.selectMethods(controller.getClass(), BINDER_METHODS)
|
MethodIntrospector.selectMethods(controller.getClass(), BINDER_METHODS)
|
||||||
.stream()
|
.stream()
|
||||||
.map(method -> new SyncInvocableHandlerMethod(controller, method))
|
.map(method -> new SyncInvocableHandlerMethod(controller, method))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
|
|
||||||
WebBindingInitializer bindingInitializer = new ConfigurableWebBindingInitializer();
|
WebBindingInitializer bindingInitializer = new ConfigurableWebBindingInitializer();
|
||||||
return new InitBinderBindingContext(bindingInitializer, binderMethods);
|
return new InitBinderBindingContext(bindingInitializer, binderMethods);
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ package org.springframework.web.servlet.config.annotation;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.springframework.core.OrderComparator;
|
import org.springframework.core.OrderComparator;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
|
|
@ -71,7 +70,7 @@ public class InterceptorRegistry {
|
||||||
return this.registrations.stream()
|
return this.registrations.stream()
|
||||||
.sorted(INTERCEPTOR_ORDER_COMPARATOR)
|
.sorted(INTERCEPTOR_ORDER_COMPARATOR)
|
||||||
.map(InterceptorRegistration::getInterceptor)
|
.map(InterceptorRegistration::getInterceptor)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ import java.util.Set;
|
||||||
import java.util.concurrent.CompletionException;
|
import java.util.concurrent.CompletionException;
|
||||||
import java.util.concurrent.CompletionStage;
|
import java.util.concurrent.CompletionStage;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import jakarta.servlet.http.Cookie;
|
import jakarta.servlet.http.Cookie;
|
||||||
|
|
@ -336,7 +335,7 @@ final class DefaultEntityResponseBuilder<T> implements EntityResponse.Builder<T>
|
||||||
return messageConverters.stream()
|
return messageConverters.stream()
|
||||||
.filter(messageConverter -> messageConverter.canWrite(entityClass, null))
|
.filter(messageConverter -> messageConverter.canWrite(entityClass, null))
|
||||||
.flatMap(messageConverter -> messageConverter.getSupportedMediaTypes(entityClass).stream())
|
.flatMap(messageConverter -> messageConverter.getSupportedMediaTypes(entityClass).stream())
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
@ -490,7 +489,7 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
|
||||||
|
|
||||||
result.addAll(this.locationResources);
|
result.addAll(this.locationResources);
|
||||||
if (isOptimizeLocations()) {
|
if (isOptimizeLocations()) {
|
||||||
result = result.stream().filter(Resource::exists).collect(Collectors.toList());
|
result = result.stream().filter(Resource::exists).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.locationsToUse.clear();
|
this.locationsToUse.clear();
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
@ -413,7 +412,7 @@ public abstract class AbstractSockJsSession implements SockJsSession {
|
||||||
Collections.<String>emptyList() : Collections.singletonList(messages[i]));
|
Collections.<String>emptyList() : Collections.singletonList(messages[i]));
|
||||||
default -> Arrays.stream(Arrays.copyOfRange(messages, i, messages.length))
|
default -> Arrays.stream(Arrays.copyOfRange(messages, i, messages.length))
|
||||||
.filter(message -> !message.trim().isEmpty())
|
.filter(message -> !message.trim().isEmpty())
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue