File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Threads and Synchronization and the fly likes Callable collection methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Callable collection methods" Watch "Callable collection methods" New topic
Author

Callable collection methods

meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305


1

Why does it always choose output 1 ?


My one regret in life is that I am not someone else.
- Woody Allen
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4375
    
    8

You're adding the same CallableCollection 6times to a HashSet. The last 5 times have no effect, because the set won't allow duplicates.

Also, the first call to call for any CallableCollection will return 1. And you only call it once on any CallableCollection.
meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305


six

Thanks, i made some changes, now it gives me different output each time.
meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Callable collection methods