Click here to Skip to main content
15,846,004 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an arraylist which contains 10 values.

I have also created a thread array.
I want to assign the thread arraylist values equally to each thread in the array, having a thread count as 5.
ie. Each thread will get 2 values from array list.

How do I assign those two values from arraylist to each thread?
Also I need to run those threads in parallel.
Updated 10-Dec-10 0:02am
Dalek Dave 10-Dec-10 5:02am    
Edited for Readability.

1 solution

You could make the arraylist a static globally public item, and just let each thread access it's own index in that array.

EDIT ================

Once again, I don't understand why this was voted a 1. It was an honest attempt at getting you pointed in the right direction. I'm not going to provide code when I don't have time/desire to write and test it.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900