Computer Science Canada

ArrayList help :s

Author:  Fasih [ Wed May 18, 2011 7:05 pm ]
Post subject:  ArrayList help :s

Ok so arraylist has got me pegged because I have an assignment about ArrayList and I don't get them.

I have an ArrayList of objects, each is initialized with a value, which is the card number. The code to determine what the suit is is done in the other class. There are some things I don't understand how to do.

Do I have to make the arraylist a constructor or can I just declare it like:

code:
public ArrayList<Cards> deck = new ArrayList <Cards>();




How would I go about randomizing the order at which the deck is displayed? I send each card in the array to another class that loads and draws the image, but how would I "shuffle" the array? Would I have to use an array of int and use Math.random to get numbers, and then send it specifically?


: