Commit 855d596c authored by dreis2211's avatar dreis2211 Committed by Stephane Nicoll

Use lazy lambda instead of explicit argument

See gh-21986
parent ab51f3a0
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -318,7 +318,7 @@ class HttpExchangeTracerTests { ...@@ -318,7 +318,7 @@ class HttpExchangeTracerTests {
@Override @Override
protected void postProcessRequestHeaders(Map<String, List<String>> headers) { protected void postProcessRequestHeaders(Map<String, List<String>> headers) {
headers.remove("to-remove"); headers.remove("to-remove");
headers.putIfAbsent("to-add", Collections.singletonList("42")); headers.computeIfAbsent("to-add", (key) -> Collections.singletonList("42"));
} }
} }
......
...@@ -36,7 +36,7 @@ public final class WebServiceClientExcludeFilter ...@@ -36,7 +36,7 @@ public final class WebServiceClientExcludeFilter
protected WebServiceClientExcludeFilter(Class<?> testClass) { protected WebServiceClientExcludeFilter(Class<?> testClass) {
super(testClass); super(testClass);
this.components = getAnnotation().getValue("components", Class[].class).orElse(new Class[0]); this.components = getAnnotation().getValue("components", Class[].class).orElseGet(() -> new Class<?>[0]);
} }
@Override @Override
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -84,7 +84,7 @@ public class MustacheView extends AbstractUrlBasedView { ...@@ -84,7 +84,7 @@ public class MustacheView extends AbstractUrlBasedView {
DataBuffer dataBuffer = exchange.getResponse().bufferFactory().allocateBuffer(); DataBuffer dataBuffer = exchange.getResponse().bufferFactory().allocateBuffer();
try (Reader reader = getReader(resource)) { try (Reader reader = getReader(resource)) {
Template template = this.compiler.compile(reader); Template template = this.compiler.compile(reader);
Charset charset = getCharset(contentType).orElse(getDefaultCharset()); Charset charset = getCharset(contentType).orElseGet(this::getDefaultCharset);
try (Writer writer = new OutputStreamWriter(dataBuffer.asOutputStream(), charset)) { try (Writer writer = new OutputStreamWriter(dataBuffer.asOutputStream(), charset)) {
template.execute(model, writer); template.execute(model, writer);
writer.flush(); writer.flush();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment