
net.cassite.f.While Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of f Show documentation
Show all versions of f Show documentation
a library to write async vert.x code similar as using java syntax
The newest version!
package net.cassite.f;
import io.vertx.core.Future;
import org.jetbrains.annotations.NotNull;
import java.util.function.BooleanSupplier;
import java.util.function.Supplier;
public class While {
private While() {
}
public static WhileLoop cond(@NotNull Supplier> condition) {
if (condition == null)
throw new NullPointerException();
return new WhileLoop(condition);
}
public static WhileLoop cond(@NotNull BooleanSupplier condition) {
if (condition == null)
throw new NullPointerException();
return cond(() -> F.unit(condition.getAsBoolean()));
}
public static class WhileLoop {
private final Supplier> condition;
WhileLoop(Supplier> condition) {
this.condition = condition;
}
public Monad> yield(@NotNull Supplier> func) {
if (func == null)
throw new NullPointerException();
return For.init(null).cond(c -> condition.get()).incrSync(c -> {
}).yield(c -> func.get());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy