For primitives, you can always force yourself to use Integer:
lazy Integer i = f();
and make sure f() never returns null. You can do something similar with
a library class (e.g., Optional) for references. So there are surely
_safe_ ways to do it, albeit ugly ones.
I kind of prefer to
On April 18, 2018 8:39:12 PM UTC, Brian Goetz wrote:
>
>
>> Ahh, you missed the `lazy` keyword on there :-) Which is good because
>
>> it raises an issue: when you forget it, bad performance may result
>> without other observable consequence. Although, it's already the
Ahh, you missed the `lazy` keyword on there :-) Which is good because
it raises an issue: when you forget it, bad performance may result
without other observable consequence. Although, it's already the case
that reading code like the above ought to raise all kinds of alarm
bells (e.g., now