@ParametersAreNonnullByDefault public final class LazyLong extends Object
long by using a LongSupplier during the first call to getAsLong().| Modifier and Type | Method and Description |
|---|---|
long |
getAsLong()
Gets the wrapped value.
|
void |
ifLoaded(LongConsumer 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 LazyLong |
of(long value)
Creates a new lazy long with the embed value.
|
void |
unload()
Unloads the wrapped value.
|
void |
update(long newValue)
Updates the wrapped value.
|
void |
update(LongUnaryOperator updateOperator)
Updates the wrapped value with a
LongUnaryOperator. |
static LazyLong |
with(LongSupplier loadFunction)
Creates a new lazy long with the
LongSupplier to load the embed value. |
@Nonnull public static LazyLong of(long value)
value - the embed value@Nonnull public static LazyLong with(LongSupplier loadFunction)
LongSupplier to load the embed value.loadFunction - the function used to load the valuepublic long getAsLong()
public void update(long newValue)
newValue - the new valuepublic void update(LongUnaryOperator updateOperator)
LongUnaryOperator.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(LongConsumer 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.