Java – who has a useful mnemonic to implement a comparator?
•
Java
Whenever I need to perform a comparison, I get stuck when I go back to - 1, when I need to go back to - 1, and I have to find
I mean, obviously - 1 is less, so that means the first is less than a second But as long as I say to myself, I get that "nag," are you sure? Feel I suspect that part of my confusion comes from other ways when I need a descending sort
What do you use to remember which is which?
Solution
comparator. compare(a,b) 0< ==> a< b
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码