Skip to content

Commit

Permalink
#265 more ctors
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jun 29, 2017
1 parent 3f1bc7e commit ad01303
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/main/java/org/cactoos/func/AsyncFunc.java
Expand Up @@ -27,6 +27,7 @@
import java.util.concurrent.Future;
import java.util.concurrent.ThreadFactory;
import org.cactoos.Func;
import org.cactoos.Proc;

/**
* Func that runs in the background.
Expand Down Expand Up @@ -60,15 +61,32 @@ public final class AsyncFunc<X, Y> implements Func<X, Future<Y>> {

/**
* Ctor.
* @param fnc The proc
* @param proc The proc
*/
public AsyncFunc(final Proc<X> proc) {
this(new ProcAsFunc<>(proc));
}

/**
* Ctor.
* @param fnc The func
*/
public AsyncFunc(final Func<X, Y> fnc) {
this(fnc, Executors.defaultThreadFactory());
}

/**
* Ctor.
* @param fnc The proc
* @param proc The proc
* @param fct Factory
*/
public AsyncFunc(final Proc<X> proc, final ThreadFactory fct) {
this(new ProcAsFunc<>(proc), fct);
}

/**
* Ctor.
* @param fnc The func
* @param fct Factory
*/
public AsyncFunc(final Func<X, Y> fnc, final ThreadFactory fct) {
Expand Down

0 comments on commit ad01303

Please sign in to comment.