Java Code Examples for java.util.function.Function#toString()

The following examples show how to use java.util.function.Function#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NestedLambdaTarget.java    From AVM with MIT License 6 votes vote down vote up
@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);
    };
}
 
Example 2
Source File: Parser.java    From jparsec with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
    }
  };
}
 
Example 3
Source File: MessageBatcher.java    From data-highway with Apache License 2.0 5 votes vote down vote up
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()));
}
 
Example 4
Source File: TeasyFluentWait.java    From teasy with MIT License 5 votes vote down vote up
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!");
        }
    }
}