All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mperry.fg.FutureExtension.groovy Maven / Gradle / Ivy

There is a newer version: 0.8
Show newest version
package com.github.mperry.fg

import fj.P1
import fj.control.parallel.Promise
import fj.control.parallel.Strategy
import groovy.transform.TypeChecked

import java.util.concurrent.Future

import static fj.control.parallel.Promise.promise
import static fj.control.parallel.Strategy.simpleThreadStrategy

/**
 * Created by MarkPerry on 18/04/2014.
 */
@TypeChecked
class FutureExtension {

    static  P1 p(Future f ) {
        Strategy.obtain(f)
    }

    static  Promise promise(Future f) {
        FutureExtension.promise(f, simpleThreadStrategy())
    }

    static  Promise promise(Future f, Strategy s) {
        Promise.promise(s, p(f))
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy