Fixing closable stream

This commit is contained in:
Martin Stockhammer 2020-07-07 23:57:59 +02:00
parent dcf4c111e5
commit 21f02d4e81
1 changed files with 2 additions and 1 deletions

View File

@ -90,7 +90,8 @@ public class StorageUtil
*/ */
public static Stream<StorageAsset> newAssetStream( StorageAsset start, boolean parallel ) public static Stream<StorageAsset> newAssetStream( StorageAsset start, boolean parallel )
{ {
return StreamSupport.stream( new AssetSpliterator( start ), parallel ); final AssetSpliterator spliterator = new AssetSpliterator( start );
return StreamSupport.stream( spliterator, parallel ).onClose( ( ) -> spliterator.close( ) );
} }