This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes Parallel for-loop in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Parallel for-loop in java" Watch "Parallel for-loop in java" New topic

Parallel for-loop in java

Prabhjot Jassal

Joined: Jul 19, 2010
Posts: 22
I am new to concurrency and would be thankful if someone could help.

I wrote the following code which has 2 arrays and in the 3rd array I am storing the answer of corresponding 1st and 2nd array. Can someone please tell me how to make it run in parallel? If possible please tell me 2 methods - 1. Using Threads and 2. Using Java 5 or 6 concurrent library. Thanks

Henry Wong

Joined: Sep 28, 2004
Posts: 18545

The Sun tutorial should be a good place to start learning about threads (and the concurrency package)...

This isn't a subject that you can learn from one example, posted in a forum topic.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
I agree. Here's the link:
subject: Parallel for-loop in java
Similar Threads
please can you help to identify those errors
How to do �shallow copy� and �deep copy�?
Question on similar & identical of Objects
"Non-static method cannot be referenced from a static context" ?
convert ArrayList of String[] to String[][]