1 min readFeb 9, 2020
Thanks for your response. As per the specification, the purpose of orElseGet
is to invoke the supplier interface to retrieve a value if the optional does not contain a value. The main observation here is that the supplier is invoked iff the optional does not contain any value. Thus, it has little to do with async nature we see in promise.