Class Memoizer
- java.lang.Object
-
- com.azure.spring.cloud.context.core.util.Memoizer
-
public class Memoizer extends Object
Memorize function execution result- Author:
- Warren Zhu
-
-
Constructor Summary
Constructors Constructor Description Memoizer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T,U,R>
BiFunction<T,U,R>memoize(BiFunction<T,U,R> biFunction)
Memoizes a bi-function.static <T,R>
Function<T,R>memoize(Function<T,R> fn)
Memoizes a function.static <T,U,R>
BiFunction<T,U,R>memoize(Map<Tuple<T,U>,R> map, BiFunction<T,U,R> biFunction)
Memoizes a bi-function into a specific cache map.static <T,R>
Function<T,R>memoize(Map<T,R> map, Function<T,R> fn)
Memoizes a function into a specific cache map.
-
-
-
Method Detail
-
memoize
public static <T,R> Function<T,R> memoize(Function<T,R> fn)
Memoizes a function.- Type Parameters:
T
- Input type for the function.R
- Output type for the function.- Parameters:
fn
- The function to memoize.- Returns:
- The memoized function.
-
memoize
public static <T,R> Function<T,R> memoize(Map<T,R> map, Function<T,R> fn)
Memoizes a function into a specific cache map.- Type Parameters:
T
- Input type for the function.R
- Output type for the function.- Parameters:
map
- The memoize cache map.fn
- The function to memoize.- Returns:
- The memoized function.
-
memoize
public static <T,U,R> BiFunction<T,U,R> memoize(BiFunction<T,U,R> biFunction)
Memoizes a bi-function.- Type Parameters:
T
- First input type for the function.U
- Second input type for the function.R
- Output type for the function.- Parameters:
biFunction
- The bi-function to memoize.- Returns:
- The memoized bi-function.
-
memoize
public static <T,U,R> BiFunction<T,U,R> memoize(Map<Tuple<T,U>,R> map, BiFunction<T,U,R> biFunction)
Memoizes a bi-function into a specific cache map.- Type Parameters:
T
- First input type for the function.U
- Second input type for the function.R
- Output type for the function.- Parameters:
map
- The memoize cache map.biFunction
- The bi-function to memoize.- Returns:
- The memoized bi-function.
-
-