I want to sort seq1 ascending and seq2 descending so I do this:
list = list.stream().sorted(comparing(AClass::getSeq1).thenComparing(
AClass::getSeq2).reversed()).collect(toList());
But the result come out as both seq1 and seq2 are sorted in descending order.
I can do this to make seq1 ascending and seq2 descending:
sorted(comparing(AClass::getSeq1)
.reversed().thenComparing(AClass::getSeq2).reversed()
What is really the correct way to do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…