From a5746d0a0377d8ccba0e216d495b05a5a01f01bb Mon Sep 17 00:00:00 2001 From: LiangYong <517219382@qq.com> Date: Mon, 19 Aug 2019 11:30:05 +0800 Subject: [PATCH] Simplify some code See gh-17893 --- .../web/reactive/ReactiveWebServerFactoryConfiguration.java | 2 +- .../boot/devtools/filewatch/FileSystemWatcher.java | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryConfiguration.java index 0a14bc90e3..e03963cd3d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryConfiguration.java @@ -69,7 +69,7 @@ abstract class ReactiveWebServerFactoryConfiguration { ObjectProvider routes, ObjectProvider serverCustomizers) { NettyReactiveWebServerFactory serverFactory = new NettyReactiveWebServerFactory(); serverFactory.setResourceFactory(resourceFactory); - routes.orderedStream().forEach((route) -> serverFactory.addRouteProviders(route)); + routes.orderedStream().forEach(serverFactory::addRouteProviders); serverFactory.getServerCustomizers().addAll(serverCustomizers.orderedStream().collect(Collectors.toList())); return serverFactory; } diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java index 2182497a50..01675086a2 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java @@ -165,9 +165,7 @@ public class FileSystemWatcher { } private void saveInitialSnapshots() { - for (File folder : this.folders.keySet()) { - this.folders.put(folder, new FolderSnapshot(folder)); - } + this.folders.replaceAll((f, v) -> new FolderSnapshot(f)); } /**