List of usage examples for java.util.concurrent CompletableFuture supplyAsync
public static <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier)
From source file:ru.histone.v2.evaluator.Evaluator.java
private CompletableFuture<EvalNode> processRegExp(ExpAstNode node) { return CompletableFuture.supplyAsync(() -> { final LongAstNode flagsNumNode = node.getNode(1); final long flagsNum = flagsNumNode.getValue(); int flags = 0; if ((flagsNum & AstRegexType.RE_IGNORECASE.getId()) != 0) { flags |= Pattern.CASE_INSENSITIVE; }/*from ww w. j a va 2s . c o m*/ if ((flagsNum & AstRegexType.RE_MULTILINE.getId()) != 0) { flags |= Pattern.MULTILINE; } final boolean isGlobal = (flagsNum & AstRegexType.RE_GLOBAL.getId()) != 0; final StringAstNode expNode = node.getNode(0); final String exp = expNode.getValue(); final Pattern pattern = Pattern.compile(exp, flags); return new RegexEvalNode(new HistoneRegex(isGlobal, pattern)); }); }