Kevin Bear

Greenhorn
+ Follow
since Mar 12, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kevin Bear

Many thanks to Alan and Steve for the replies.

Perhaps, perhaps not. You don't show what happens with callableList in the code you provide, and we have no clue what the Callable code is doing, so it is impossible to say with the code you provided.



Sorry I made some mistake in decribing how the Callable module works. The callableList is used in the callable module (for 1000 times in the innnermost for-loop) to generate a result. What happens in the Callable(callableList) module is like this:

An addtional question: I have an ArrayList of Objects (I'll name it callableList) for use in the Callable module. callableList gets some new items (as well as get some items removed) every time the program enters the innnermost for loop. It seems that this would cause concurrency problem, but the test I ran seems to be fine. I am now totally confused with all the concurrency ideas

I am using an ArrayList to store some information, the code looks like this:



Two questions:
1. Will the order of the results in the list be guaranteed? (From what I read, it seems not. But the experiments I have done always produce nicely ordered results)
2. if I use the following code to examine the result after the for loops, will the get() method ensure that all the calculations in the for loops completed before the result is examined?



Thanks in advance for all the help.