ai.timefold.solver.spring.boot.autoconfigure.util.LambdaUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of timefold-solver-spring-boot-autoconfigure Show documentation
Show all versions of timefold-solver-spring-boot-autoconfigure Show documentation
Timefold solves planning problems.
This lightweight, embeddable planning engine implements powerful and scalable algorithms
to optimize business resource scheduling and planning.
This module contains the Spring Boot autoconfigure.
package ai.timefold.solver.spring.boot.autoconfigure.util;
import java.util.function.Function;
public class LambdaUtils {
public static Function rethrowFunction(ThrowingFunction throwingFunction) {
return v -> {
try {
return throwingFunction.apply(v);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
};
}
@FunctionalInterface
public interface ThrowingFunction {
R apply(T t) throws Exception;
}
private LambdaUtils() {
// No external instances.
}
}