Toot

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 | View the thread | More toots from StrangeNoises@mastodon.social

Mentions

Tags

=> View java tag

Proxy Information
Original URL
gemini://mastogem.picasoft.net/toot/113770378347527416
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
230.577536 milliseconds
Gemini-to-HTML Time
0.519729 milliseconds

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