-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce basic Flow<T>.chunked operator #4127
Conversation
A few things about this PR:
API shape brain dump (eventually I'll move it towards a better-structured issue, but not there yet): There exists a whole bunch of possibilities, use cases and things full-blown
The problem with time is that it requires the actual concurrency, while the size-based version does not. I'm still exploring the possibility of something like |
Co-authored-by: Dmitry Khalanskiy <52952525+dkhalanskyjb@users.noreply.github.com>
|
||
/** | ||
* Splits the given flow into a flow of non-overlapping lists each not exceeding the given [size] but never empty. | ||
* The last emitted list may have fewer elements than the given size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please name the parameter maxSize
then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my original intent, but stdlib disagrees on that: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/chunked.html
A nice thing to consider tho
Fixes #1290