lundi 28 mars 2016

Converting from enhanced for loop to for loop

I am looking to write a method without using enhanced loops, but am not sure how to convert them exactly. The method is:

public static int charFrequency (String[]s, char c){

    int freq = 0;
    for(String s2 : s) {
        char[] newArray = createChars(s2);
        for (char c2: newArray)
            if(c2 == c) freq++;
    }
}

Aucun commentaire:

Enregistrer un commentaire