Re:Elegant Error Handling with the JavaScript “Either” Monad
by ubertaco on Wednesday June 19, 2019 @04:13PM
(#20226886)
A use-case I've had for a quick right-biased Java Either I threw together is handling a migration from java.util.Date to java.time.LocalDate:
I use the right-biased-ness of the Either to prefer the new format, if available, but failing that, use the old format and then convert as needed.
[ Parent
| on HN ]
Re:Elegant Error Handling with the JavaScript “Either” Monad
by james-mcelwain on Wednesday June 19, 2019 @04:33PM
(#20227048)
This could be accomplished using Optional#orElseGet without any additional library dependencies, though.