com.github.mperry.fg.FutureExtension.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of functionalgroovy-main Show documentation
Show all versions of functionalgroovy-main Show documentation
FunctionalGroovy enhances FunctionalJava for Groovy
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