Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Offer Stream-conversion out-of-the-box #8

Open
CLOVIS-AI opened this issue May 6, 2024 · 0 comments
Open

Offer Stream-conversion out-of-the-box #8

CLOVIS-AI opened this issue May 6, 2024 · 0 comments

Comments

@CLOVIS-AI
Copy link
Collaborator

fun <T> MongoIterable<T>.asStream(): Stream<T> = cursor().let {
    StreamSupport.stream(Spliterators.spliteratorUnknownSize(it.iterator(), Spliterator.ORDERED), false)
        .onClose(it::close)
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant