lundi 10 juin 2019

I cannot add arraylists to if statements, I cannot use .contains in an if statement on an arraylist

SO, this might sound stupid but arraylists dont work in if statements for me plz fix

ive tried many things with fixing the code itself and altering it but nope

Cannot invoke contains(String) on the array type String[]

for(int x = 0; x < wordArray.length; x++) {
        if(wordA.contains(wordArray[x])) {
            int count = 0;
            count = map.get(wordArray[x]);
            count++;
            map.remove(wordArray[x]);
            map.put(wordArray[x], count);
        } else {
            map.put(wordArray[x], 1);
        }
     }

Aucun commentaire:

Enregistrer un commentaire