momentohq / client-sdk-java

Official Java SDK for Momento Serverless Cache
Apache License 2.0
13 stars 5 forks source link

fix: storage SDK orElseThrow should take a supplier #383

Closed cprice404 closed 2 months ago

cprice404 commented 2 months ago

The orElseThrow signature of Java Optionals requires a single arg, supplier, that is a lambda function returning the exception that the user wishes to have thrown if the optional is empty. In our current storage client code we have an empty-args signature, which would be surprising to Java users familiar with Optionals. This commit updates the signature to accept a supplier.