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

New collect operator #297

Closed
pditommaso opened this issue Mar 6, 2017 · 1 comment
Closed

New collect operator #297

pditommaso opened this issue Mar 6, 2017 · 1 comment
Milestone

Comments

@pditommaso
Copy link
Member

pditommaso commented Mar 6, 2017

Introduce a new collect operator that allow to collect the items produced by a channel into list object.

The collect operator has the following advantages over the existing toList object.

Examples:

Channel
    .from( 1, 2, 3, 4 )
    .collect()
    .println()

# outputs
[1,2,3,4]

The following example shows how use a mapper closure:

Channel
    .from( 'hello', 'ciao', 'bonjour' )
    .collect { it.length() }
    .println()

# outputs
[5,4,7]
@pditommaso
Copy link
Member Author

Included in version 0.24.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant