Package org.elasticsearch.common.util
Class CachedSupplier<T>
java.lang.Object
org.elasticsearch.common.util.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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
CachedSupplier
-
-
Method Details
-
get
- Specified by:
get
in interfacejava.util.function.Supplier<T>
-