Skip to content

Instantly share code, notes, and snippets.

@mike-neck
Created June 17, 2011 11:04
Show Gist options
  • Save mike-neck/1031220 to your computer and use it in GitHub Desktop.
Save mike-neck/1031220 to your computer and use it in GitHub Desktop.
GPars Sample Map-Reduce
import static groovyx.gpars.GParsPool.*;
withPool {
assert 30 ==
[1,2,3,4,5,6,7,8,9,10].parallel
.filter {
println "filter -> $it"
it <= 5
}
.map {
println "map -> $it"
it * 2
}
.reduce {a, b ->
println "reduce $a $b"
a + b
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment