How to make an operator that is like Ruby <=> (a.k.a.: spaceship)

82 Views Asked by At

I have a sample code below that is made with swift and using <=> ,I want to convert it to android but I have no clue how to do.I want to convert the following sample to android with java. Some tips or examples will be great! I would love to hear from you.

let sortItems = self.getSortItems(item: itm) <=> self.getSortItems(item: itm2)
let sortIt = itm.checker <=> itms2.checker
if sortIt != 0 {
    return sortIt * -1
}
0

There are 0 best solutions below