I'm intentionally left out first line of the run method not to violate the rule to post complete solution. t is currentThread.
When I run this code, I found that all the inputs are stored only one of the thread instead of being randomly distributed - that's what I thought after reading the code. Could anyone explain why it stores only in a single thread?
while(!t.isInterrupted()){
try{
String s = reader.readLine();
if(s != null){
readStringCount.incrementAndGet();
result.add(s);
}
} catch(IOException e){}
}