h2. Enables parallel collection processing and functional style with map/reduce

h3. Parallel collection processing

The following methods are currently supported on all objects in Groovy:
* eachParallel()
* eachWithIndexParallel()
* collectParallel()
* findAllParallel()
* findParallel()
* everyParallel()
* anyParallel()
* grepParallel()
* groupByParallel()
* foldParallel()
* minParallel()
* maxParallel()
* sumParallel()

{code} //summarize numbers concurrently
 ForkJoinPool.withPool {
     final AtomicInteger result = new AtomicInteger(0)
     [1, 2, 3, 4, 5].eachParallel {result.addAndGet(it)}
     assert 15 == result
 }

 //multiply numbers asynchronously
 ForkJoinPool.withPool {
     final List result = [1, 2, 3, 4, 5].collectParallel {it * 2}
     assert ([2, 4, 6, 8, 10].equals(result))
 }
{code}

h3. Meta-class enhancer

{code}import groovyx.gpars.ParallelEnhancer

def list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
ParallelEnhancer.enhanceInstance(list)
println list.collectParallel {it * 2 }
{code}

h3. Transparently parallel collections

{code}
ForkJoinPool.withPool {

    //The selectImportantNames() will process the name collections concurrently
    assert ['ALICE', 'JASON'] == selectImportantNames(['Joe', 'Alice', 'Dave', 'Jason'].makeConcurrent())
}

/**
 * A function implemented using standard sequential collect() and findAll() methods.
 */
def selectImportantNames(names) {
    names.collect {it.toUpperCase()}.findAll{it.size() > 4}
}
{code}

h3. Map/Reduce

Available methods:
* map()
* reduce()
* filter()
* size()
* sum()
* min()
* max()

The _collection_ property will return all elements wrapped in a Groovy collection instance.

{code}
    println 'Number of occurrences of the word GROOVY today: ' + urls.parallel
            .map {it.toURL().text.toUpperCase()}
            .filter {it.contains('GROOVY')}
            .map{it.split()}
            .map{it.findAll{word -> word.contains 'GROOVY'}.size()}
            .sum()
{code}
