Skip to content
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

Flow.forEach method #1244

Closed
fvasco opened this issue Jun 2, 2019 · 0 comments
Closed

Flow.forEach method #1244

fvasco opened this issue Jun 2, 2019 · 0 comments
Labels

Comments

@fvasco
Copy link
Contributor

fvasco commented Jun 2, 2019

Currently the way to visit a Flow is using the collect method.
I am worried about this name, because a non trained developer is tempted to looking for a xxxEach method (see here).
Unfortunately the only available method is onEach, worse this isn't a terminal method.

A solution is to find another name to visit a flow, otherwise I propose to add -for now- the following method:

@Deprecated("forEach is harmful, use collect instead", ReplaceWith("this.collect(action)"))
public suspend inline fun <T> Flow<T>.forEach(noinline action: suspend (T) -> Unit) = collect(action)
@qwwdfsad qwwdfsad added the flow label Jun 3, 2019
qwwdfsad added a commit that referenced this issue Jun 4, 2019
qwwdfsad added a commit that referenced this issue Jun 4, 2019
qwwdfsad added a commit that referenced this issue Jun 5, 2019
qwwdfsad added a commit that referenced this issue Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants