I want to create exactly 3 ArrayLists to store some Card class variables (Its for a card game).
I tried this:
private ArrayList<Card>[] hands = new ArrayList<Card>[3];
However Eclipse is showing an error saying: "Cannot create a generic array of ArrayList<Card>"
The rest of the code is beautifully simple if I can manage this...if not...ill have to keep calling differnt arraylists for different player numbers...
e.g. to add card to playerNumber = 3
public int getNumCards(int playerNumber)
{
return hands[playerNumber].size();
}
Is simpler than multiple if/else statements to check which playerNumber was entered and then call an arraylist accordingly...
Thank You,
Cheers,
Vyder