/RaceOfThreads

Race of Threads

Primary LanguageJava

RaceOfThreads

Create an ArrayList of numbers from 1 to 10000 (10 thousand).

Next, divide the 10 thousand elements in this ArrayList into 4 equal parts to be 2500 elements.

Design 4 separate Threads that find odd and even numbers in these 4 separate 2500-element ArrayLists.

4 Thread will add the even numbers it finds to a common ArrayList.

4 Thread will add the odd numbers it finds to a common ArrayList.

ArrayLists holding odd and even numbers will be empty when first created. And they will be two ArrayLists.

4 When Thread starts processing its own 2500-element ArrayList, it will fill the odd and even number ArrayLists.