Kotlin result type in java

Viewed 1223

Kotlin introduced the new type: Result. I use it as a completion handler of several functions like this:

fun myFunction(completion: (Result<Boolean>) -> Unit)

Unfortunately I cannot use it in java. Java doesn't propose me getters like getOrNull or even isSuccess/isFailure.

How could I use it? Thanks

1 Answers

There is no standard support for Result like types in Java but you can always use third-party libraries like HubSpot/algebra.

Related