/** * Returns a cache loader based on an <i>existing</i> function instance. Note that there's no need * to create a <i>new</i> function just to pass it in here; just subclass {@code CacheLoader} and * implement {@link #load load} instead. * * @param function the function to be used for loading values; must never return {@code null} * @return a cache loader that loads values by passing each key to {@code function} */ @Beta public static <K, V> CacheLoader<K, V> from(Function<K, V> function) { return new FunctionToCacheLoader<K, V>(function); }
/** * Returns a cache loader that uses {@code function} to load keys, without supporting either * reloading or bulk loading. This allows creating a cache loader using a lambda expression. * * @param function the function to be used for loading values; must never return {@code null} * @return a cache loader that loads values by passing each key to {@code function} */ public static <K, V> CacheLoader<K, V> from(Function<K, V> function) { return new FunctionToCacheLoader<>(function); }
/** * Returns a {@code CacheLoader} which creates values by applying a {@code Function} to the key. */ public static <K, V> CacheLoader<K, V> from(Function<K, V> function) { return new FunctionToCacheLoader<K, V>(function); }
/** * Returns a cache loader that uses {@code function} to load keys, without supporting either * reloading or bulk loading. This allows creating a cache loader using a lambda expression. * * @param function the function to be used for loading values; must never return {@code null} * @return a cache loader that loads values by passing each key to {@code function} */ public static <K, V> CacheLoader<K, V> from(Function<K, V> function) { return new FunctionToCacheLoader<>(function); }
/** * Returns a cache loader based on an <i>existing</i> function instance. Note that there's no need * to create a <i>new</i> function just to pass it in here; just subclass {@code CacheLoader} and * implement {@link #load load} instead. * * @param function the function to be used for loading values; must never return {@code null} * @return a cache loader that loads values by passing each key to {@code function} */ @Beta public static <K, V> CacheLoader<K, V> from(Function<K, V> function) { return new FunctionToCacheLoader<K, V>(function); }
/** * Returns a cache loader based on an <i>existing</i> function instance. Note that there's no need * to create a <i>new</i> function just to pass it in here; just subclass {@code CacheLoader} and * implement {@link #load load} instead. * * @param function the function to be used for loading values; must never return {@code null} * @return a cache loader that loads values by passing each key to {@code function} */ @Beta public static <K, V> CacheLoader<K, V> from(Function<K, V> function) { return new FunctionToCacheLoader<K, V>(function); }
/** * Returns a cache loader based on an <i>existing</i> function instance. Note that there's no need * to create a <i>new</i> function just to pass it in here; just subclass {@code CacheLoader} and * implement {@link #load load} instead. * * @param function the function to be used for loading values; must never return {@code null} * @return a cache loader that loads values by passing each key to {@code function} */ @Beta public static <K, V> CacheLoader<K, V> from(Function<K, V> function) { return new FunctionToCacheLoader<K, V>(function); }
/** * Returns a cache loader based on an <i>existing</i> function instance. Note that there's no need * to create a <i>new</i> function just to pass it in here; just subclass {@code CacheLoader} and * implement {@link #load load} instead. * * @param function the function to be used for loading values; must never return {@code null} * @return a cache loader that loads values by passing each key to {@code function} */ @Beta public static <K, V> CacheLoader<K, V> from(Function<K, V> function) { return new FunctionToCacheLoader<K, V>(function); }
/** * Returns a cache loader based on an <i>existing</i> function instance. Note that there's no need * to create a <i>new</i> function just to pass it in here; just subclass {@code CacheLoader} and * implement {@link #load load} instead. * * @param function the function to be used for loading values; must never return {@code null} * @return a cache loader that loads values by passing each key to {@code function} */ @Beta public static <K, V> CacheLoader<K, V> from(Function<K, V> function) { return new FunctionToCacheLoader<K, V>(function); }
/** * Returns a cache loader based on an <i>existing</i> function instance. Note that there's no need * to create a <i>new</i> function just to pass it in here; just subclass {@code CacheLoader} and * implement {@link #load load} instead. * * @param function the function to be used for loading values; must never return {@code null} * @return a cache loader that loads values by passing each key to {@code function} */ @Beta public static <K, V> CacheLoader<K, V> from(Function<K, V> function) { return new FunctionToCacheLoader<K, V>(function); }
/** * Returns a cache loader based on an <i>existing</i> function instance. Note that there's no need * to create a <i>new</i> function just to pass it in here; just subclass {@code CacheLoader} and * implement {@link #load load} instead. * * @param function the function to be used for loading values; must never return {@code null} * @return a cache loader that loads values by passing each key to {@code function} */ public static <K, V> CacheLoader<K, V> from(Function<K, V> function) { return new FunctionToCacheLoader<K, V>(function); }
/** * Returns a cache loader that uses {@code function} to load keys, without supporting either * reloading or bulk loading. This allows creating a cache loader using a lambda expression. * * @param function the function to be used for loading values; must never return {@code null} * @return a cache loader that loads values by passing each key to {@code function} */ public static <K, V> CacheLoader<K, V> from(Function<K, V> function) { return new FunctionToCacheLoader<>(function); }
/** * Returns a cache loader that uses {@code function} to load keys, and without supporting either * reloading or bulk loading. This is most useful when you can pass a lambda expression. Otherwise * it is useful mostly when you already have an existing function instance. * * @param function the function to be used for loading values; must never return {@code null} * @return a cache loader that loads values by passing each key to {@code function} */ public static <K, V> CacheLoader<K, V> from(Function<K, V> function) { return new FunctionToCacheLoader<>(function); }
/** * Returns a cache loader that uses {@code function} to load keys, without supporting either * reloading or bulk loading. This allows creating a cache loader using a lambda expression. * * @param function the function to be used for loading values; must never return {@code null} * @return a cache loader that loads values by passing each key to {@code function} */ public static <K, V> CacheLoader<K, V> from(Function<K, V> function) { return new FunctionToCacheLoader<>(function); }