I have an object Card that is created using two enums, those being Suit and Rank. These enums read as such (apologies for formatting, not quite sure how to get it right):
public enum Suit
{
HEARTS(),
DIAMONDS(),
SPADES(),
CLUBS();
}
public enum Rank
{
TWO(),
THREE(),
FOUR(),
FIVE(),
SIX(),
SEVEN(),
EIGHT(),
NINE(),
TEN(),
JACK(),
QUEEN(),
KING(),
ACE();
}
The Card constructor is as follows:
public Card(Suit s, Rank r) //s and r are fields in class Card
{
suit = s;
rank = r;
}
So let's say a Card object is made with Suit DIAMONDS and Rank NINE, which I know to be indexes 1 and 7, respectively.
A method called Hand is dealing with an ArrayList of 5 Card objects and is going to sort them by value to make them easier to arrange in a certain manner. Is it possible to obtain these indexes from the Card object for this purpose, or is there some other way to do it?
Added note, this is for an assignment, so I am under constraint of needing to use the enums and ArrayLists.