Use Spliterator of underlying collection
Delegate to the spliterator method of the underlying collection in MutablePropertyValues and MutablePropertySources. In both cases, those collection types have specialized Spliterator implementations. Delegating to these Spliterators also means the characteristics of the Spliterator are properly set. See gh-32281
This commit is contained in:
committed by
Stéphane Nicoll
parent
4230c41d97
commit
481283d2f1
@@ -25,7 +25,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Spliterator;
|
||||
import java.util.Spliterators;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
@@ -255,7 +254,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
|
||||
@Override
|
||||
public Spliterator<PropertyValue> spliterator() {
|
||||
return Spliterators.spliterator(this.propertyValueList, 0);
|
||||
return this.propertyValueList.spliterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.core.env;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Spliterator;
|
||||
import java.util.Spliterators;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -69,7 +68,7 @@ public class MutablePropertySources implements PropertySources {
|
||||
|
||||
@Override
|
||||
public Spliterator<PropertySource<?>> spliterator() {
|
||||
return Spliterators.spliterator(this.propertySourceList, 0);
|
||||
return this.propertySourceList.spliterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user