I would like to make an 'infinite' list of strings for an application. I attempted to use this....
public static void runinfinite(int length) {
String lastString= " ";
while (true) {
if (lastString.length() > length)
break;
lastString = lastString.trim();
for (char c0 = 'a'; c0 <= 'z'; c0++) {
lastString += c0;
action(lastString);
}
}
}
It only gives me this: abcdefghijklmnopqrstuvwxyz
. Does anyone have a block of code that will make strings 'infinitely'?
Edit: I need it to make a list of strings like this example: [doesn't need to be in the same order, just a bunch of strings]
Edit 2: I want to make this example work better, and run forever.