Created
January 16, 2012 00:47
-
-
Save bartenbach/1618267 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void sortHand(){ | |
LinkedList<Card> spades = new LinkedList<Card>(); | |
for(Card x : playerHand){ | |
if(x.getSuit() == Suit.SPADES){ | |
spades.add(x); | |
} | |
Collections.sort(spades); | |
} | |
LinkedList<Card> diamonds = new LinkedList<Card>(); | |
for(Card x : playerHand){ | |
if(x.getSuit() == Suit.DIAMONDS){ | |
diamonds.add(x); | |
} | |
Collections.sort(diamonds); | |
} | |
LinkedList<Card> clubs = new LinkedList<Card>(); | |
for(Card x : playerHand){ | |
if(x.getSuit() == Suit.CLUBS){ | |
clubs.add(x); | |
} | |
Collections.sort(clubs); | |
} | |
LinkedList<Card> hearts = new LinkedList<Card>(); | |
for(Card x : playerHand){ | |
if(x.getSuit() == Suit.HEARTS){ | |
hearts.add(x); | |
} | |
Collections.sort(hearts); | |
} | |
LinkedList<Card> temp = new LinkedList<Card>(); | |
temp.addAll(hearts); | |
temp.addAll(clubs); | |
temp.addAll(diamonds); | |
temp.addAll(spades); | |
playerHand = temp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment