<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Tue, Jun 17, 2025 at 3:34 PM Maurizio Cimadamore <<a href="mailto:maurizio.cimadamore@oracle.com">maurizio.cimadamore@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div><p>Note that this is already part of the StableValue API: <a href="https://download.java.net/java/early_access/jdk25/docs/api/java.base/java/lang/StableValue.html#supplier(java.util.function.Supplier)" target="_blank">https://download.java.net/java/early_access/jdk25/docs/api/java.base/java/lang/StableValue.html#supplier(java.util.function.Supplier)</a><br></p></div></blockquote><div><br></div><div>Yes, that's where my thoughts incepted. When I noticed it, I wondered whether a new type is the best solution for lazy initialization of final values (and still believe a Supplier.cache(Supplier<T> computer) would be a nice addition). But your answer about the scope of StableValue being broader than just lazy initialization makes my comment not so relevant.</div></div></div>