It seems that the functions just need to return 3 different values โโdepending on whether it is less, equal to or greater than b. Groovy already has a statement that does this:
a <=> b
The return values โโare -1, 0, and 1. It might be best to reorganize the code to use this operator instead of xMethod, if possible.
Of course, if the exact values โโ1, 2 and 3 are important, and not just 3 different values, you cannot do this.
source
share