Class CachedFunction<T,R>

java.lang.Object
org.moddingx.libx.util.lazy.CachedFunction<T,R>
All Implemented Interfaces:
Function<T,R>

public class CachedFunction<T,R> extends Object implements Function<T,R>
Wraps a pure function. This makes sure, that the given function is only called once for each key. The computed values will then be stored to avoid recomputing them.
  • Constructor Details

    • CachedFunction

      public CachedFunction(Function<T,R> function)
  • Method Details