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

vertx.effect.exp.All Maven / Gradle / Ivy

There is a newer version: 5.0.0
Show newest version
package vertx.effect.exp;

import vertx.effect.Val;
import vertx.effect.core.AbstractVal;

import java.util.ArrayList;
import java.util.List;

import static java.util.Objects.requireNonNull;

public abstract class All extends AbstractVal {

    @SafeVarargs
    public static Val parallel(final Val a,
                               final Val... others) {
        List> exps = new ArrayList<>();
        exps.add(requireNonNull(a));
        for (final Val other : others) {
            exps.add(requireNonNull(other));
        }
        return new ParallelAll(exps);
    }

    @SafeVarargs
    public static Val sequential(final Val a,
                                 final Val... others) {
        List> exps = new ArrayList<>();
        exps.add(requireNonNull(a));
        for (final Val other : others) {
            exps.add(requireNonNull(other));
        }
        return new SequentialAll(exps);
    }

    public static Val of(final boolean a,
                                  final boolean... others) {
        List exps = new ArrayList<>();
        exps.add(a);
        for (final boolean other : others) {
            exps.add(other);
        }
        return Cons.success(exps.stream()
                                .allMatch(it -> it)
                           );
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy