Class CachedSupplier<T>

  • All Implemented Interfaces:
    Supplier<T>

    public final class CachedSupplier<T>
    extends Object
    implements 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 Detail

      • CachedSupplier

        public CachedSupplier​(Supplier<T> supplier)
    • Method Detail

      • get

        public T get()
        Specified by:
        get in interface Supplier<T>