下面列出了java.util.function.Function#toString ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Callable
public static void createLambda() {
function = (s1) -> {
Function<Integer, Integer> f2 = (i1) -> {
Function<BigInteger, BigInteger> f3 = (bi1) -> {
return bi1.add(bi1);
};
f3.hashCode();
f3.toString();
return ++i1 + f3.apply(new BigInteger("2389652398")).intValue();
};
f2.hashCode();
f2.toString();
return s1 + f2.apply(5);
};
}
/**
* A {@link Parser} that executes {@code this}, maps the result using {@code map} to another {@code Parser} object
* to be executed as the next step.
*/
public final <To> Parser<To> next(
final Function<? super T, ? extends Parser<? extends To>> map) {
return new Parser<To>() {
@Override boolean apply(ParseContext ctxt) {
return Parser.this.apply(ctxt) && runNext(ctxt);
}
@Override public String toString() {
return map.toString();
}
private boolean runNext(ParseContext state) {
T from = Parser.this.getReturn(state);
return map.apply(from).apply(state);
}
};
}
public MessageBatcher(
int bufferSize,
int maxBatchSize,
EnqueueBehaviour enqueueBehaviour,
Function<List<MESSAGE>, List<RESPONSE>> batchHandler) {
this(bufferSize, maxBatchSize, enqueueBehaviour, batchHandler,
r -> new Thread(r, "batcher-" + batchHandler.toString()));
}
public <R> R waitFor(Function<? super T, R> condition) {
try {
return until(condition);
} catch (Throwable ignoredAndContinue) {
if (nullOnFailure) {
//todo add some logging here if necessary
return null;
} else {
throw new AssertionError("Condition: " + condition.toString() + " failed!");
}
}
}