Class CachingSupplier<T>

  • Type Parameters:
    T -
    All Implemented Interfaces:
    java.util.function.Supplier<T>

    public class CachingSupplier<T>
    extends java.lang.Object
    implements java.util.function.Supplier<T>
    A supplier wrapper which caches the supplied values. This class is not threadsafe!
    Since:
    FileVault 4.0.2
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T get()
      Uses the cached value from previous get() calls instead of contacting the underlying delegate
      static <T> CachingSupplier<T> of​(@NotNull java.util.function.Supplier<T> supplier)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • of

        public static <T> CachingSupplier<T> of​(@NotNull
                                                @NotNull java.util.function.Supplier<T> supplier)
      • get

        @Nullable
        public T get()
        Uses the cached value from previous get() calls instead of contacting the underlying delegate
        Specified by:
        get in interface java.util.function.Supplier<T>
        Returns:
        the resolved value (can be null);