Sort java.util.Deque
问题 I want to sort the contents of my Deque<Card> collection using the Card class' getRealValue() method. public class Card implements Comparable<Card> { private final int value; private final CardType cardType; public Card(int value, CardType cardType) { this.value = value; this.cardType = cardType; } public int getRealValue() { int realValue = this.value == 1 ? 52 : 0; return realValue + this.value * 4 + this.cardType.ordinal(); } public int compareTo(Card o) { return this.getRealValue() - o