Java: How to Sort
Posted on 2011-09-10
I am creating a poker game and having a bit of difficulty with sorting. In particular I am working with a method (Poker Hand - Straight) which accepts an ArrayList.
I need to take this ArrayList and store it in some kind of a "SORTABLE" List.
All I have right now for the Straight Method is:
public void five_card_straight(ArrayList<Card> s)
// ArrayList s holds objects of type Card. Card has 2 private variables -- Rank & Suit.
// The objects passed as S are: J 9 8 T 7 -- All of these are chars and T stands for 10.
How do I sort it as 7 8 9 T J?
Professor gave me a hint -- "Comparable".
Completely forgot how to sort.