You can do it using syntax like the following:
for (String s: cdSporNavn){
if(s.indexOf("java") != -1){
System.out.println(s);
}
}
See Using Enhanced For-Loops with Your Classes for further information and examples.
0
solved enhanced for loop (java) [duplicate]