This question is asking another method for sorting other than using Collections.reverse()
.
I wanted to sort a list in ascending and descending also. I want to do that without using override methods. I have tried Collections.reverse()
.It worked fine. But I want to find another method. Anyone can help me with that?
Collections.sort(list, (Comparator.<ModelPortfolioDTO>
comparingDouble(mp1 -> Double.parseDouble(mp1.getSharpRatio()))
.thenComparingDouble(mp2 -> Double.parseDouble(mp2.getSharpRatio()))));