Browse Source

Replace lambdas with method references

Closes gh-9049
pull/75/merge
Eddú Meléndez 9 years ago committed by Stephane Nicoll
parent
commit
1d9fa8395c
  1. 2
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
  2. 3
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/reactor/core/ReactorCoreAutoConfiguration.java
  3. 4
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java
  4. 3
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration.java
  5. 3
      spring-boot/src/test/java/org/springframework/boot/context/properties/source/AbstractPropertyMapperTests.java
  6. 3
      spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java

2
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java

@ -108,7 +108,7 @@ public class FlywayAutoConfiguration { @@ -108,7 +108,7 @@ public class FlywayAutoConfiguration {
this.flywayDataSource = flywayDataSource.getIfAvailable();
this.migrationStrategy = migrationStrategy.getIfAvailable();
this.flywayCallbacks = flywayCallbacks
.getIfAvailable(() -> Collections.emptyList());
.getIfAvailable(Collections::emptyList);
}
@PostConstruct

3
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/reactor/core/ReactorCoreAutoConfiguration.java

@ -30,6 +30,7 @@ import org.springframework.context.annotation.Configuration; @@ -30,6 +30,7 @@ import org.springframework.context.annotation.Configuration;
* {@link EnableAutoConfiguration Auto-configuration} for Reactor Core.
*
* @author Brian Clozel
* @author Eddú Meléndez
*/
@Configuration
@ConditionalOnClass({ Mono.class, Flux.class })
@ -39,7 +40,7 @@ public class ReactorCoreAutoConfiguration { @@ -39,7 +40,7 @@ public class ReactorCoreAutoConfiguration {
@Autowired
protected void initialize(ReactorCoreProperties properties) {
if (properties.getStacktraceMode().isEnabled()) {
Hooks.onOperator(h -> h.operatorStacktrace());
Hooks.onOperator(Hooks.OperatorHook::operatorStacktrace);
}
}

4
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java

@ -138,7 +138,7 @@ public class ThymeleafAutoConfiguration { @@ -138,7 +138,7 @@ public class ThymeleafAutoConfiguration {
ObjectProvider<Collection<IDialect>> dialectsProvider) {
this.templateResolvers = templateResolvers;
this.dialects = dialectsProvider
.getIfAvailable(() -> Collections.emptyList());
.getIfAvailable(Collections::emptyList);
}
@Bean
@ -222,7 +222,7 @@ public class ThymeleafAutoConfiguration { @@ -222,7 +222,7 @@ public class ThymeleafAutoConfiguration {
ObjectProvider<Collection<IDialect>> dialectsProvider) {
this.templateResolvers = templateResolvers;
this.dialects = dialectsProvider
.getIfAvailable(() -> Collections.emptyList());
.getIfAvailable(Collections::emptyList);
}
@Bean

3
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration.java

@ -73,6 +73,7 @@ import org.springframework.web.reactive.result.view.ViewResolver; @@ -73,6 +73,7 @@ import org.springframework.web.reactive.result.view.ViewResolver;
* @author Stephane Nicoll
* @author Andy Wilkinson
* @author Phillip Webb
* @author Eddú Meléndez
* @since 2.0.0
*/
@Configuration
@ -157,7 +158,7 @@ public class WebFluxAutoConfiguration { @@ -157,7 +158,7 @@ public class WebFluxAutoConfiguration {
public void configureViewResolvers(ViewResolverRegistry registry) {
if (this.viewResolvers != null) {
AnnotationAwareOrderComparator.sort(this.viewResolvers);
this.viewResolvers.forEach(resolver -> registry.viewResolver(resolver));
this.viewResolvers.forEach(registry::viewResolver);
}
}

3
spring-boot/src/test/java/org/springframework/boot/context/properties/source/AbstractPropertyMapperTests.java

@ -27,6 +27,7 @@ import org.springframework.core.env.PropertySource; @@ -27,6 +27,7 @@ import org.springframework.core.env.PropertySource;
*
* @author Phillip Webb
* @author Madhura Bhave
* @author Eddú Meléndez
*/
public abstract class AbstractPropertyMapperTests {
@ -52,7 +53,7 @@ public abstract class AbstractPropertyMapperTests { @@ -52,7 +53,7 @@ public abstract class AbstractPropertyMapperTests {
PropertySource<?> propertySource = new MapPropertySource("test",
Collections.singletonMap(name, value));
return getMapper().map(propertySource, ConfigurationPropertyName.of(name))
.stream().map((mapping) -> mapping.getPropertySourceName()).iterator();
.stream().map(PropertyMapping::getPropertySourceName).iterator();
}
}

3
spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java

@ -37,6 +37,7 @@ import static org.assertj.core.api.Assertions.fail; @@ -37,6 +37,7 @@ import static org.assertj.core.api.Assertions.fail;
*
* @author Phillip Webb
* @author Madhura Bhave
* @author Eddú Meléndez
*/
public class ConfigurationPropertyNameTests {
@ -235,7 +236,7 @@ public class ConfigurationPropertyNameTests { @@ -235,7 +236,7 @@ public class ConfigurationPropertyNameTests {
}
private Iterator<String> streamElements(String name) {
return ConfigurationPropertyName.of(name).stream().map((e) -> e.toString())
return ConfigurationPropertyName.of(name).stream().map(Element::toString)
.iterator();
}

Loading…
Cancel
Save