-
@ApiStatus.Internal() public final class AndroidLazyEvaluator<T>Class that evaluates a function lazily. It means the evaluator function is called only when getValue is called, and it's cached. Same as LazyEvaluator but accepts Context as an argument for getValue.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceAndroidLazyEvaluator.AndroidEvaluator
-
Constructor Summary
Constructors Constructor Description AndroidLazyEvaluator(AndroidLazyEvaluator.AndroidEvaluator<T> evaluator)Class that evaluates a function lazily.
-
Method Summary
Modifier and Type Method Description TgetValue(@NotNull() Context context)Executes the evaluator function and caches its result, so that it's called only once, unlessresetValue is called. TgetValue(@NotNull() Context context)Executes the evaluator function and caches its result, so that it's called only once, unlessresetValue is called. voidresetValue()Resets the internal value and forces the evaluator function to be called the next timegetValue() is called. -
-
Constructor Detail
-
AndroidLazyEvaluator
AndroidLazyEvaluator(AndroidLazyEvaluator.AndroidEvaluator<T> evaluator)
Class that evaluates a function lazily.- Parameters:
evaluator- The function to evaluate.
-
-
Method Detail
-
getValue
@Nullable() T getValue(@NotNull() Context context)
Executes the evaluator function and caches its result, so that it's called only once, unlessresetValue is called.
-
getValue
@Nullable() T getValue(@NotNull() Context context)
Executes the evaluator function and caches its result, so that it's called only once, unlessresetValue is called.
-
resetValue
void resetValue()
Resets the internal value and forces the evaluator function to be called the next timegetValue() is called.
-
-
-
-