Skip to content

Commit d5ccd43

Browse files
committed
Merge pull request #13343 from dreis2211:property-source-stream-polish
* pr/13343: Polish stream creation in some PropertySources
2 parents 95174a0 + 29605ba commit d5ccd43

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/AliasedIterableConfigurationPropertySource.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@
1818

1919
import java.util.List;
2020
import java.util.stream.Stream;
21-
import java.util.stream.StreamSupport;
2221

2322
import org.springframework.util.CollectionUtils;
2423

@@ -39,8 +38,7 @@ class AliasedIterableConfigurationPropertySource
3938

4039
@Override
4140
public Stream<ConfigurationPropertyName> stream() {
42-
return StreamSupport.stream(getSource().spliterator(), false)
43-
.flatMap(this::addAliases);
41+
return getSource().stream().flatMap(this::addAliases);
4442
}
4543

4644
private Stream<ConfigurationPropertyName> addAliases(ConfigurationPropertyName name) {

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/FilteredIterableConfigurationPropertiesSource.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@
1818

1919
import java.util.function.Predicate;
2020
import java.util.stream.Stream;
21-
import java.util.stream.StreamSupport;
2221

2322
/**
2423
* A filtered {@link IterableConfigurationPropertySource}.
@@ -38,7 +37,7 @@ class FilteredIterableConfigurationPropertiesSource
3837

3938
@Override
4039
public Stream<ConfigurationPropertyName> stream() {
41-
return StreamSupport.stream(getSource().spliterator(), false).filter(getFilter());
40+
return getSource().stream().filter(getFilter());
4241
}
4342

4443
@Override

0 commit comments

Comments
 (0)