I have the following for loop:
for(String s : someString.split("\\s+")){
//do something
}
Does java execute the split() method each time the loop iterates, or does it do it only once and keep a temp array to iterate on?
It only does it once, and uses that array and interates through it.
Edit: from Mat This is the reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With