From 2afe560e41c52c51a36314de3884416a9b1ed432 Mon Sep 17 00:00:00 2001 From: Vikey Chen Date: Fri, 17 Jun 2022 17:45:00 +0800 Subject: [PATCH] Replace forEach with putAll See gh-28646 --- .../org/springframework/web/reactive/BindingContext.java | 4 ++-- .../web/reactive/socket/client/JettyWebSocketClient.java | 4 ++-- .../web/reactive/socket/client/StandardWebSocketClient.java | 4 ++-- .../web/reactive/socket/client/UndertowWebSocketClient.java | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/BindingContext.java b/spring-webflux/src/main/java/org/springframework/web/reactive/BindingContext.java index d10616e6b6..12b21d61a1 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/BindingContext.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/BindingContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-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. @@ -136,7 +136,7 @@ public class BindingContext { return Mono.zip(Mono.just(vars), Mono.just(queryParams), formData, multipartData) .map(tuple -> { Map result = new TreeMap<>(); - tuple.getT1().forEach(result::put); + result.putAll(tuple.getT1()); tuple.getT2().forEach((key, values) -> addBindValue(result, key, values)); tuple.getT3().forEach((key, values) -> addBindValue(result, key, values)); tuple.getT4().forEach((key, values) -> addBindValue(result, key, values)); diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/JettyWebSocketClient.java b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/JettyWebSocketClient.java index 9bbeb08f84..48c46ec67f 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/JettyWebSocketClient.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/JettyWebSocketClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-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. @@ -182,7 +182,7 @@ public class JettyWebSocketClient implements WebSocketClient, Lifecycle { private HandshakeInfo createHandshakeInfo(URI url, Session jettySession) { HttpHeaders headers = new HttpHeaders(); - jettySession.getUpgradeResponse().getHeaders().forEach(headers::put); + headers.putAll(jettySession.getUpgradeResponse().getHeaders()); String protocol = headers.getFirst("Sec-WebSocket-Protocol"); return new HandshakeInfo(url, headers, Mono.empty(), protocol); } diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/StandardWebSocketClient.java b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/StandardWebSocketClient.java index 4bf98585a0..67ef0e7db4 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/StandardWebSocketClient.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/StandardWebSocketClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-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. @@ -171,7 +171,7 @@ public class StandardWebSocketClient implements WebSocketClient { @Override public void afterResponse(HandshakeResponse response) { - response.getHeaders().forEach(this.responseHeaders::put); + this.responseHeaders.putAll(response.getHeaders()); } } diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/UndertowWebSocketClient.java b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/UndertowWebSocketClient.java index 272e04f345..e8280c84b4 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/UndertowWebSocketClient.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/UndertowWebSocketClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-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. @@ -243,7 +243,7 @@ public class UndertowWebSocketClient implements WebSocketClient { @Override public void beforeRequest(Map> headers) { - this.requestHeaders.forEach(headers::put); + headers.putAll(this.requestHeaders); if (this.delegate != null) { this.delegate.beforeRequest(headers); } @@ -251,7 +251,7 @@ public class UndertowWebSocketClient implements WebSocketClient { @Override public void afterRequest(Map> headers) { - headers.forEach(this.responseHeaders::put); + this.responseHeaders.putAll(headers); if (this.delegate != null) { this.delegate.afterRequest(headers); }