Skip to content

Commit 789ba37

Browse files
authored
Merge pull request #223 from mattbertolini/mbertolini/resource-collection-stream-support
Use StreamSupport and spliterator to create a stream for ResourceCollection
2 parents 708513e + 033eee2 commit 789ba37

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/main/org/apache/tools/ant/types/ResourceCollection.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package org.apache.tools.ant.types;
1515

1616
import java.util.stream.Stream;
17+
import java.util.stream.StreamSupport;
1718

1819
/**
1920
* Interface describing a collection of Resources.
@@ -46,9 +47,7 @@ public interface ResourceCollection extends Iterable<Resource> {
4647
* @since Ant 1.10.2
4748
*/
4849
default Stream<? extends Resource> stream() {
49-
final Stream.Builder<Resource> b = Stream.builder();
50-
forEach(b);
51-
return b.build();
50+
return StreamSupport.stream(spliterator(), false);
5251
}
5352

5453
/**

0 commit comments

Comments
 (0)