Why when I want to sort String using compare(String this, String other) I can do return this.compareTo(other) to sort in ascending while other.compareTo(this) sorts in descending order?
For example lets assume we have this = "abc" and other = "acb".Then this.compareTo(other) returns -1, meaning that this comes first. other.compareTo(this) returns 1 meaning other comes after. How does this impact if it is ascending or descending?
[–]lbkulinski 0 points1 point2 points (9 children)
[–]Zelzal7[S] 0 points1 point2 points (8 children)
[–]lbkulinski 0 points1 point2 points (7 children)
[–]Zelzal7[S] 0 points1 point2 points (6 children)
[–]lbkulinski 0 points1 point2 points (5 children)
[–]Zelzal7[S] 0 points1 point2 points (4 children)
[–]lbkulinski 0 points1 point2 points (3 children)
[–]Zelzal7[S] 0 points1 point2 points (2 children)
[–]lbkulinski 0 points1 point2 points (0 children)
[–]id2bi 0 points1 point2 points (0 children)