Comment

Comment by hardwaresofton

While I'm sure you're aware, Java 1.8 does have Optional support (https://docs.oracle.com/javase/8/docs/api/java/util/Optional...). Once Jack is completed (https://developer.android.com/guide/platform/j8-jack.html) I assume you'll be able to use it too. Of course, you can also just use a library (like Guava) that makes Optionals available (and somewhat close to the spec so you can phase it out in the future if need be).

Some quick googling found me: http://fernandocejas.com/2016/02/20/how-to-use-optional-on-a... ...

One thing I've found is that once you start using Optionals, they tend to infect (I don't mean this in a bad way) the rest of the code. You start to want Optionals everywhere, and start writing maps/orElses everywhere, which I personally love. The error-handling paradigm changes a little bit (to errors-as-values, which I personally appreciate as well), but some are turned off by having optionals everywhere.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton