1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| listeCartes = new ArrayList<Carte>(); // Créer un tableau d'objets de type Carte
//Créer une carte avec tous ses champs
listeCartes.add( new Carte("Photos/photo0.png", "Photos/dos.png", 0, "Capteur de position du papillon", "Throttle position sensor", "Description0","Système d'alimentation" ));
listeCartes.add( new Carte("Photos/photo1.png", "Photos/dos.png", 1, "Alternateur", "Alternator", "Description1","Système de charge" ));
listeCartes.add( new Carte("Photos/photo2.png", "Photos/dos.png", 2, "Amortisseur", "Shock absorber", "Description2","Système de suspension" ));
listeCartes.add( new Carte("Photos/photo50.png", "Photos/dos.png", 50, "Lien de barre stabilisatrice", "Stabilizer link", "Description50","Système de suspension" ));
listeCartes.add( new Carte("Photos/photo51.png", "Photos/dos.png", 51, "Embout de biellette", "Tie rod end", "Description51","Système de direction" ));
Collections.shuffle(listeCartes); // Mélanger toutes les photos du dossier de photos
listeCartes.subList((nombreDeCartes/2), listeCartes.size()).clear(); //Sélectionne que les 26 premières cartes de la liste
int size=listeCartes.size(); //Double les premières 26 cartes
for(int i=0; i<size; i++) {
Carte carte = listeCartes.get(i);
listeCartes.add(new Carte(carte.getUrlFace(),
carte.getUrlDos(),
carte.getId(),
carte.getPrenom(),
carte.getNom(),
carte.getDepartement(),
carte.getFonction() |
Partager