I have two threads that read two files. Each thread collects information from objects. As the two threads continue to read the file, I want to add the generated objects to a map or a temp list which are shared by the threads, and I want to process the added objects from the map/temp list simultaneously as they are added.

I am interested in using producer/consumer model for this. But will it be the way to use it on a process which itself depends on two threads? Can `BlockingQueue`s be used in these cases?