Ancestors

Written by Rachel Greenham on 2025-01-04 at 13:43

here's a #java style question.

// completed with null if not found

CompletableFuture findObject();

// completed exceptionally if not found

CompletableFuture findObject();

// empty Optional if not found

CompletableFuture<Optional> findObject();

they'd all work so this is about style. which would be preferred?

the middle one is odd-one-out as it semantically says it's an error if the object can't be found rather than that being allowable.

=> More informations about this toot | More toots from StrangeNoises@mastodon.social

Toot

Written by Rachel Greenham on 2025-01-04 at 13:44

i would tend to return the Optional if it was direct and not in a Future. But in the context of returning a Future it feels excessively clunky maybe?

[#]java

=> More informations about this toot | More toots from StrangeNoises@mastodon.social

Descendants

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113770382763355928
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
280.16417 milliseconds
Gemini-to-HTML Time
0.566249 milliseconds

This content has been proxied by September (3851b).