Class Suppliers

java.lang.Object
org.apache.juneau.commons.function.Suppliers

public class Suppliers extends Object
Supplier factories: memoizing wrappers moved from the former Utils.
  • Constructor Details

    • Suppliers

      protected Suppliers()
      Constructor — this class is meant to be subclassed.
  • Method Details

    • memoize

      public static <T> NullableSupplier<T> memoize(Supplier<T> supplier)
      Thread-safe memoizing supplier (computes once, caches).
      Type Parameters:
      T - The type of value supplied.
      Parameters:
      supplier - The underlying supplier to memoize. Must not be null.
      Returns:
      A new memoizing supplier.
    • memoizer

      public static <T> Memoizer<T> memoizer(Supplier<T> supplier)
      Resettable memoizing supplier.
      Type Parameters:
      T - The type of value supplied.
      Parameters:
      supplier - The underlying supplier to memoize. Must not be null.
      Returns:
      A new resettable memoizing supplier.