dimanche 13 novembre 2016

How to assign string values to elements of an arraylist?

I have created a linkedlist of strings with random number values and an arrayList, I want to be able to assign the strings to each of the elements in my arrayList to essentially create a virtual set of cards each.

List rabbits = new LinkedList<>();

   attributes.add("Beveren");
   attributes.add("Belgian Hare");
   attributes.add("Britannia Petite"); 
   attributes.add("deilenaar");
   attributes.add("French Angora"); 

   Random random = new Random(); 
   String randomRabbits = rabbits.get(new Random().nextInt(rabbits.size()));

  and 

  static final int deck_size = 25;

  ArrayList<Integer> rabbitCards = new ArrayList<Integer>(deck_size);

Many thanks to anyone who is able to assist me.




Aucun commentaire:

Enregistrer un commentaire