X
- Type of inputY
- Type of outputpublic final class AsyncFunc<X,Y> extends Object implements Func<X,Future<Y>>
If you want your piece of code to be executed in the background,
use AsyncFunc
as following:
int length = new AsyncFunc( input -> input.length() ).apply("Hello, world!").get();
There is no thread-safety guarantee.
Func.NoNulls<X,Y>
public AsyncFunc(Proc<X> proc, ThreadFactory fct)
proc
- The procfct
- Factorypublic AsyncFunc(Func<X,Y> fnc, ThreadFactory fct)
fnc
- The funcfct
- Factorypublic AsyncFunc(Func<X,Y> fnc, ExecutorService exec)
fnc
- The funcexec
- Executor ServiceCopyright © 2017 Cactoos. All rights reserved.