Package cloud.opencode.base.functional.function
package cloud.opencode.base.functional.function
Function Utilities - Advanced function operations
函数工具 - 高级函数操作
Provides function composition, currying, memoization, and additional checked functional interfaces extending Core module.
提供函数组合、柯里化、记忆化以及扩展 Core 模块的可抛异常函数接口。
Features | 主要功能:
FunctionUtil- Function utilitiesCheckedBiFunction- Checked BiFunctionCheckedBiConsumer- Checked BiConsumerTriFunction- Three-argument function
Usage Examples | 使用示例:
// Composition
var composed = FunctionUtil.compose(f, g); // g(f(x))
// Currying
BiFunction<Integer, Integer, Integer> add = (a, b) -> a + b;
Function<Integer, Integer> add5 = FunctionUtil.curry(add).apply(5);
// Memoization
Function<Integer, Integer> fib = FunctionUtil.memoize(n ->
n <= 1 ? n : fib.apply(n-1) + fib.apply(n-2));
// Partial application
Function<String, String> greet = FunctionUtil.partial(
(greeting, name) -> greeting + ", " + name, "Hello");
- Since:
- JDK 25, opencode-base-functional V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
ClassDescriptionCheckedBiConsumer<T,
U> CheckedBiConsumer - BiConsumer that can throw checked exceptions CheckedBiConsumer - 可抛出受检异常的双参消费者CheckedBiFunction<T,U, R> CheckedBiFunction - BiFunction that can throw checked exceptions CheckedBiFunction - 可抛出受检异常的双参函数CheckedConsumer - Consumer that may throw checked exceptions CheckedConsumer - 可能抛出受检异常的消费者CheckedFunction<T,R> CheckedFunction - Function that can throw checked exceptions CheckedFunction - 可抛出受检异常的函数CheckedRunnable - Runnable that may throw checked exceptions CheckedRunnable - 可能抛出受检异常的可运行接口FunctionUtil - Function composition, currying, and memoization utilities FunctionUtil - 函数组合、柯里化和记忆化工具类TriFunction<T1,T2, T3, R> TriFunction - Three-argument function TriFunction - 三参函数