- java.lang.Object
-
- dagger.internal.DoubleCheck<T>
-
- All Implemented Interfaces:
Lazy<T>,jakarta.inject.Provider<T>
public final class DoubleCheck<T> extends java.lang.Object implements jakarta.inject.Provider<T>, Lazy<T>
ALazyandProviderimplementation that memoizes the value returned from a delegate using the double-check idiom described in Item 71 of Effective Java 2.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Tget()Return the underlying value, computing the value if necessary.static <P extends jakarta.inject.Provider<T>,T>
Lazy<T>lazy(P provider)Returns aLazythat caches the value from the given provider.static <P extends jakarta.inject.Provider<T>,T>
jakarta.inject.Provider<T>provider(P delegate)Returns aProviderthat caches the value from the given delegate provider.
-
-
-
Method Detail
-
get
public T get()
Description copied from interface:LazyReturn the underlying value, computing the value if necessary. All calls to the sameLazyinstance will return the same result.
-
provider
public static <P extends jakarta.inject.Provider<T>,T> jakarta.inject.Provider<T> provider(P delegate)
Returns aProviderthat caches the value from the given delegate provider.
-
-