Class LazyValue<T>

  • Type Parameters:
    T - type of wrapped value

    public class LazyValue<T>
    extends Object
    Wrapper for a value that should only be lazily initialised when being accessed for the first time.
    • Constructor Detail

      • LazyValue

        public LazyValue​(Supplier<? extends T> supplier)
        Constructor, not yet invoking the given Supplier.
        Parameters:
        supplier - value look-up to be performed the first time get() is being called
    • Method Detail

      • get

        public T get()
        Look-up the wrapped value, loading it on first invocation.
        Returns:
        wrapped value