Sinobu

kiss

Variable<V>

A re-assignable container object which may or may not contain a non-null value. If a value is present, #isPresent() returns true. If no value is present, the object is considered empty and #isPresent() returns false. Unlike Optional, this container is re-assignable.

Additional methods that depend on the presence or absence of a contained value are provided, such as #or(Object) (returns a default value if no value is present) and #to(Consumer) (performs an action if a value is present).

vV

The current value. This value is not final but read-only.

Variable(Vvalue)

Vvalue

Hide constructor.

accept(Vvalue)void

Vvalue

acquire()V

V

Current value or next value.

Get the current value. If there is no value, wait until the value is set.

exact()V

V

Current value or throws error.

Get the current value. If there is no value, NullPointerException will be thrown.

get()V

V

Current value or null.

Get the current value. If there is no value, returns null.

intercept(WiseBiFunctionV, V, Vinterceptor)VariableV

WiseBiFunctionV, V, Vinterceptor

An interceptor for value modification. First parameter is the current value, Second parameter is the new value.

VariableV

Chainable API.

Intercept the value modification.

is(Vvalue)boolean

Vvalue

A value to check the equality.

boolean

A result of equality.

Test whether the current value is equal to the specified value or not.

is(PredicateVcondition)boolean

PredicateVcondition

A value validator.

boolean

A result of validation.

Test whether the current value fulfills the specified condition or not.

isNot(Vvalue)boolean

Vvalue

A value to check the equality.

boolean

A result of equality.

Test whether the current value is NOT equal to the specified value or not.

isNot(PredicateVcondition)boolean

PredicateVcondition

A value validator.

boolean

A result of validation.

Test whether the current value does NOT fulfill the specified condition or not.

isAbsent()boolean

boolean

A result.

Check whether the value is absent or not.

isPresent()boolean

boolean

A result.

Check whether the value is present or not.

isFixed()boolean

boolean

A result.

Check whether the value is fixed or not.

fix()VariableV

VariableV

Chainable API.

Fix this value as immutable.

flip(Supplier?Rthen)VariableR

R
Supplier?Rthen

An action to perform.

VariableR

The computed Variable.

Perform the specified action if the value is absent.

flatFlip(SupplierVariableRmapper)VariableR

R
SupplierVariableRmapper

The mapping function to apply to a value, if present.

VariableR

The computed Variable.

If a value is present, returns the result of applying the given Variable-bearing mapping function to the value, otherwise returns an empty Variable.

map(Function?V, ?Rthen)VariableR

R
Function?V, ?Rthen

An action to perform.

VariableR

The computed Variable.

Perform the specified action if the value is present.

flatMap(FunctionV, VariableRmapper)VariableR

R
FunctionV, VariableRmapper

The mapping function to apply to a value, if present.

VariableR

The computed Variable.

If a value is present, returns the result of applying the given Variable-bearing mapping function to the value, otherwise returns an empty Variable.

next()V

V

The next value.

Get the value to be set next. The method waits until a new value is set.

observe()SignalV

SignalV

The Signal which notifies value modification.

Observe this Variable.

observing()SignalV

SignalV

The Signal which notifies value modification.

Observe this Variable with the current value.

or(Vother)V

Vother

A value to be returned if there is no value present, may be null.

V

The current value or alternative value.

Get the current value. If there is no value, returns the specified alternative value.

or(SupplierVother)V

SupplierVother

A value to be returned if there is no value present, may be null.

V

The current value or alternative value.

Get the current value. If there is no value, returns the specified alternative value.

set(Vvalue)V

Vvalue

A value to assign.

V

A previous value.

Assign the new value.

set(SupplierVvalue)V

SupplierVvalue

A value generator.

V

A previous value.

Assign the new value.

set(UnaryOperatorVvalue)V

UnaryOperatorVvalue

A value generator.

V

A previous value.

Assign the new value.

to(ConsumerVsome)void

ConsumerVsome

A user action.

Execute the specified action if the value is present.

to(ConsumerVsome, Runnablenone)void

ConsumerVsome

A user action.

Runnablenone

Execute the specified action.

hashCode()int

int

equals(Objectobj)boolean

Objectobj
boolean

toString()String

String

of(Tvalue)VariableT

T
Tvalue

An actual value, null will be acceptable.

VariableT

A created Variable.

Create Variable with the specified value.

empty()VariableT

T
VariableT

A new empty Variable.

Create empty Variable.