Simple extractor that looks inside of an optional values to see if the thing inside can be pulled out.
Simple extractor that looks inside of an optional values to see if the thing inside can be pulled out. If not, it just returns whatever element it can find.
Due to the introduction of null checks in
Now, let's add a
This of course is highly redundant and can be reduced to simply:
This reduction is done by the "Center Rule." There are some other simplification rules as well. Note how we are force to null-check both
map
,flatMap
, andexists
, inFlattenOptionOperation
in order to resolve #1053, as well as to support non-ansi compliant string concatenation as outlined in #1295, large conditional composites became common. For example:getOrElse
statement to the clause that requires an additional wrapped null check. We cannot rely on there being amap
call beforehand since we could be readingvalue
as a nullable field directly from the database).h.value
as well as(h.value || 'foo')
because a user may useOption[T].flatMap
and explicitly transform a particular value tonull
.