helper function to safely resolve anything
this is not an elvis operator, it resolves
a value without exception in a tree and if
it is not resolvable then an optional of
a default value is restored or Optional.empty
if none is given
usage
let var: Optiona = saveResolve(() => a.b.c.d.e, "foobaz")
Returns
an Optional of the produced value
Type Parameters
T
Parameters
resolverProducer: (() => T)
a lambda which can produce the value
(): T
Returns T
defaultValue: T = null
an optional default value if the producer failes to produce anything
helper function to safely resolve anything this is not an elvis operator, it resolves a value without exception in a tree and if it is not resolvable then an optional of a default value is restored or Optional.empty if none is given
usage
let var: Optiona = saveResolve(() => a.b.c.d.e, "foobaz")
Returns
an Optional of the produced value