Class CachedSupplier<T>

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

    public final class CachedSupplier<T>
    extends java.lang.Object
    implements java.util.function.Supplier<T>
    A Supplier that caches its return value. This may be useful to make a Supplier idempotent or for performance reasons if always returning the same instance is acceptable.
    • Constructor Summary

      Constructors 
      Constructor Description
      CachedSupplier​(java.util.function.Supplier<T> supplier)  
    • Method Summary

      Modifier and Type Method Description
      T get()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CachedSupplier

        public CachedSupplier​(java.util.function.Supplier<T> supplier)
    • Method Detail

      • get

        public T get()
        Specified by:
        get in interface java.util.function.Supplier<T>