@ParametersAreNonnullByDefault public final class LazyDouble extends Object
double by using a DoubleSupplier during the first call to getAsDouble().| Modifier and Type | Method and Description |
|---|---|
double |
getAsDouble()
Gets the wrapped value.
|
void |
ifLoaded(DoubleConsumer consumer)
If a value is loaded, invoke the specified
consumer with the value, otherwise do nothing. |
boolean |
isLoaded()
Returns
true if the value has been loaded. |
static LazyDouble |
of(double value)
Creates a new lazy double with the embed value.
|
void |
unload()
Unloads the wrapped value.
|
void |
update(double newValue)
Updates the wrapped value.
|
void |
update(DoubleUnaryOperator updateOperator)
Updates the wrapped value with a
DoubleUnaryOperator. |
static LazyDouble |
with(DoubleSupplier loadFunction)
Creates a new lazy double with the
DoubleSupplier to load the embed value. |
@Nonnull public static LazyDouble of(double value)
value - the embed value@Nonnull public static LazyDouble with(DoubleSupplier loadFunction)
DoubleSupplier to load the embed value.loadFunction - the function used to load the valuepublic double getAsDouble()
public void update(double newValue)
newValue - the new valuepublic void update(DoubleUnaryOperator updateOperator)
DoubleUnaryOperator.updateOperator - the operator to update the wrapped valuepublic boolean isLoaded()
true if the value has been loaded.true if the value has been loadedpublic void ifLoaded(DoubleConsumer consumer)
consumer with the value, otherwise do nothing.consumer - action to be executed if a value is presentpublic void unload()
Copyright © 2017–2019 Atlanmod. All rights reserved.