You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cases where an already-built optional should be assumed
Where the first input action requires an optional.
Cases where optionals should be resolved
elvis operator where fallback expression is required
var x : Integer, y : Integer[0,1];
x := y ?: 2;
Turns into:
Optional.ofNullable(y).orElseGet(() -> 2)
or
Optional.ofNullable(y).orElse(2)
Any case where an optional would be consumed by a non-optional bearing target
A chain of optionals starts when a sequence of features (method/attribute) accesses occurs in a chain (where the result of an optional expression is the target object of CallOperation or ReadStructuralFeature). So, if such chain is consumed by any other action, at this point, a resolution of the optional is required.
Should use Java Optional to implement null-safe object navigation.
Examples:
Java code:
Action breakdown:
The text was updated successfully, but these errors were encountered: