Use Stream.toList instead of Stream.collect when possible
Update code to make use of `Stream.toList()` whenever possible. Closes gh-28177
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
@@ -19,7 +19,6 @@ package org.springframework.boot.devtools.tests;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
@@ -45,8 +44,7 @@ abstract class AbstractApplicationLauncher implements ApplicationLauncher {
|
||||
}
|
||||
|
||||
protected final List<String> getDependencyJarPaths() {
|
||||
return Stream.of(this.directories.getDependenciesDirectory().listFiles()).map(File::getAbsolutePath)
|
||||
.collect(Collectors.toList());
|
||||
return Stream.of(this.directories.getDependenciesDirectory().listFiles()).map(File::getAbsolutePath).toList();
|
||||
}
|
||||
|
||||
protected final Directories getDirectories() {
|
||||
|
||||
@@ -36,11 +36,12 @@ import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jakarta.websocket.ClientEndpointConfig;
|
||||
import jakarta.websocket.ClientEndpointConfig.Configurator;
|
||||
import jakarta.websocket.Endpoint;
|
||||
import jakarta.websocket.Extension;
|
||||
import jakarta.websocket.HandshakeResponse;
|
||||
import jakarta.websocket.WebSocketContainer;
|
||||
import org.apache.tomcat.websocket.WsWebSocketContainer;
|
||||
@@ -300,11 +301,10 @@ class LiveReloadServerTests {
|
||||
InetSocketAddress remoteAddress = new InetSocketAddress(uri.getHost(), uri.getPort());
|
||||
StandardWebSocketSession session = new StandardWebSocketSession(headers, attributes, localAddress,
|
||||
remoteAddress);
|
||||
Stream<Extension> adaptedExtensions = extensions.stream().map(WebSocketToStandardExtensionAdapter::new);
|
||||
ClientEndpointConfig endpointConfig = ClientEndpointConfig.Builder.create()
|
||||
.configurator(new UppercaseWebSocketClientConfigurator(headers)).preferredSubprotocols(protocols)
|
||||
.extensions(extensions.stream().map(WebSocketToStandardExtensionAdapter::new)
|
||||
.collect(Collectors.toList()))
|
||||
.build();
|
||||
.extensions(adaptedExtensions.toList()).build();
|
||||
endpointConfig.getUserProperties().putAll(getUserProperties());
|
||||
Endpoint endpoint = new StandardWebSocketHandlerAdapter(webSocketHandler, session);
|
||||
Callable<WebSocketSession> connectTask = () -> {
|
||||
|
||||
Reference in New Issue
Block a user