org.ehcache.core.util
Class Functions

java.lang.Object
  extended by org.ehcache.core.util.Functions

public class Functions
extends java.lang.Object

A set of utilities methods and Classes around Functions


Constructor Summary
Functions()
           
 
Method Summary
static
<A,B,T> BiFunction<A,B,T>
memoize(BiFunction<A,B,T> f)
          Will transform the passed in BiFunction in a apply once and only once BiFunction.
static
<A,T> Function<A,T>
memoize(Function<A,T> f)
          Will transform the passed in Function in a apply once and only once Function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Functions

public Functions()
Method Detail

memoize

public static <A,T> Function<A,T> memoize(Function<A,T> f)
Will transform the passed in Function in a apply once and only once Function. Irrespectively of the argument passed in! And isn't thread safe. Basically acts as a dumb cache.

Type Parameters:
A - the function's input param type
T - the function's output type
Parameters:
f - the function to memoize
Returns:
the memoized function

memoize

public static <A,B,T> BiFunction<A,B,T> memoize(BiFunction<A,B,T> f)
Will transform the passed in BiFunction in a apply once and only once BiFunction. Irrespectively of the arguments passed in! And isn't thread safe. Basically acts as a dumb cache.

Type Parameters:
A - the bifunction's first input param type
B - the bifunction's second input param type
T - the function's output type
Parameters:
f - the bifunction to memoize
Returns:
the memoized bifunction