Card Sort Algorithm

Hi,

I am trying to write a program that is sorting a hand, containing 8 cards.
Each card has a color and a value. The program should compare all 8 cards and start with the highest value. If 2 or more cards have the same value the color will decide the priority.
I made a research on what possibilities I have in Java and found the compareTo-Solution, but it is not working, so maybe somebody can help me or give me the advise I need to complete my program.

}
My idea was to give the method a cardList, then to save this list in a temporary list, clear the cardList and then fill it up again with the cards from the temporary list card by card. But I still dont understand how this CompareTo really works and how to get the next object in the list.

Re: Card Sort Algorithm

Many, many thanks@all. I have something that looks very similar to your answer raz0r.
I still got strange errors, but I am confident to fix it.
Yes maybe advanced was not best area.
Andrej

Hey again,
I moved forward but still is not the result is was hoping for.
I want the cards not only sorted by value and and grouped by color but also there is the difference between trumps and not-trumps.
For instance. The "Unters"(4) and "Obers"(4) + all hearts are trumps so there are 14 at all. I want it sorted first by trumpf then by value grouped by color.