Could this code potentially result in an infinite loop?

Viewed 283

Is there any value that could be assigned to the myString variable that would result in an infinite loop in the code below?

while (true) {
    if (myString.indexOf("  ") == -1) {
        break;
    }
    myString = myString.replaceAll("  ", " ");
}
5 Answers
Related