Thanks to the advice of several tireless members here, I’m now converting a codebase to be mostly suspending. For the most part, this has been rather straightforward.
However, I have come across two issues where I haven’t been able to easily convert the code to be suspending.
The first issue is where the
equals method needs to call a suspending function. I can’t move the functionality to a different function as instances of this specific class is used as a key in a
HashMap. I obviously don’t want to add a
runBlocking in the
equals method, and I can’t see an easy solution to this.
The other issue is where the
Comparator class where the comparison function is not suspending. This means that if the comparison function needs to call a suspending function, there is no way to use the built-in sorting function.
What is the correct way to deal with this?