So guys, I have a while loop something like that
int counter=0;
ArrayList<String> array = new ArrayList<String>();
num=Math.pow(3,length);
while(counter != num)
{
String temp = generateRandomStr(length);
if(array.contains(temp)==false)
{
array.add(temp);
counter++;
}
}
To explain, I want an ArrayList with all possible String combinations of given length and 3 letters.
So if length=11 , num=177147 runtime is almost 11 minutes. With bigger length, runtime will take at least half an hour.
Is there a way to multithread this loop?
EDIT:
I've read all the responses and I thank each and every one of you. Yeah I know my code is trash and I will work on that. I do not have experience since I am a student but I will try my best to improve