Class CachedSupplier<T>

java.lang.Object
org.elasticsearch.common.util.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 Details

    • CachedSupplier

      public CachedSupplier(Supplier<T> supplier)
  • Method Details

    • get

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