Class Instance<T>

  • Type Parameters:
    T - The type of the instance.

    public class Instance<T>
    extends Object
    An instance cache that defers creation until first access.
    • Constructor Detail

      • Instance

        public Instance​(Supplier<T> supplier)
        Constructor.
        Parameters:
        supplier - The instance supplier.
    • Method Detail

      • instance

        public T instance()
        Returns the instance, creating it if required.
        Returns:
        The instance.