3 ms·
Nothing is a useful and meaningful result in a lot of cases. This is essentially a degenerate case of a discriminated union. There are other choices that can b
by Clamchop 4y ago
Nothing is a useful and meaningful result in a lot of cases. This is essentially a degenerate case of a discriminated union.
There are other choices that can be used to the same effect, such as exceptions or sealed classes. Of course, you can still use Optional<T>. But with null safety, a nullable return type is often most elegant and it's idiomatic in Kotlin.