2 pièce(s) jointe(s)
problème avec indexOf ds ArrayList
salut tout le monde j'ai un petit problème dans l'exécussion de mon code ci-joint, le compilateur quand il arrive a l'intruction int indice = Cellules.indexOf(propoUtil); il me retourne tjr -1 alors que le ArrayList Cellules comporte vraiment la valeur propoUtil :cry:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| public String autoVerif(String propoUtil){
String Resultat = "manque";
int indice = Cellules.indexOf(propoUtil);
System.out.println("je suis la ds autoVerif indic = " + indice);
if (indice >= 0){
Cellules.remove(indice);
if (Cellules.isEmpty()){
Resultat = "Coulé";
} else {
Resultat = "touché";
}
}
return Resultat;
} |
merci;