Java: what is faster split in a loop or doing it before
Goolge comes up with a lot of comparisions but not on what I am looking for:

What is better if I want to iterate through a splitted String

    String[] flagArr = flags.split(";");
    for (String f: flagArr) {
    	// some stuff
    }

OR

    for (String f: flags.split(";")) {
    	// some stuff
    }

With the second pice of code I wonder if the compiler is smart enough to do the split only once 
    
Java: what is faster split in a loop or doing it before
===

Goolge comes up with a lot of comparisions but not on what I am looking for:

What is better if I want to iterate through a splitted String

    String[] flagArr = flags.split(";");
    for (String f: flagArr) {
    	// some stuff
    }

OR

    for (String f: flags.split(";")) {
    	// some stuff
    }

With the second pice of code I wonder if the compiler is smart enough to do the split only once 
    