Package io.micronaut.core.util
Class SupplierUtil
java.lang.Object
io.micronaut.core.util.SupplierUtil
Helper methods for dealing with
Supplier
.- Since:
- 1.0
- Author:
- James Kleeh
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
SupplierUtil
public SupplierUtil()
-
-
Method Details
-
memoized
Caches the result of supplier in a thread safe manner.- Type Parameters:
T
- The type of result- Parameters:
valueSupplier
- The supplier providing the result- Returns:
- A new supplier that will cache the result
-
memoizedNonEmpty
Caches the result of supplier in a thread safe manner. The result is only cached if it is non null or non empty if an optional.- Type Parameters:
T
- The type of result- Parameters:
valueSupplier
- The supplier providing the result- Returns:
- A new supplier that will cache the result
-