Fixing closable stream
@@ -90,7 +90,8 @@ public static void walk( StorageAsset start, Function<StorageAsset, Boolean> con
*/
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( ) );
}
