Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Iterator usage Sample demo Required

 
Comal Rajagopalaratnam Muthukumar
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have been trying to know if there is any special care is given for the usage of iterator in java.util,when i have to repeat the main function in order to fetch feasible solution.
ie)
if i use (;;) in main
the main function does not respond fully.
So I want to use java.util.Iterator;
instead
Please suggest with a sample code
Thanks
As
CRMK
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure if this is what you're saying, but if you want two pieces of code to run at the same time as each other, then replacing a for loop (I assume that's what you mean by (;;)) with an iterator is not going to make any difference.
To have two pieces of code running simultaneously you have to run them in separate threads. See the Concurrency tutorial for more information.

If that's not what you meant, you may need to rephrase your question.
 
Comal Rajagopalaratnam Muthukumar
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joanne Neal wrote:I'm not sure if this is what you're saying, but if you want two pieces of code to run at the same time as each other, then replacing a for loop (I assume that's what you mean by (;;)) with an iterator is not going to make any difference.
To have two pieces of code running simultaneously you have to run them in separate threads. See the Concurrency tutorial for more information.

If that's not what you meant, you may need to rephrase your question.


Hello
Thanks however please try to make the following code to use iteration to derive a feasible soution
As
CRMK
>
 
Joanne Neal
Rancher
Posts: 3742
16
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Comal Rajagopalaratnam Muthukumar wrote:Thanks however please try to make the following code to use iteration to derive a feasible soution

A feasible solution for what ? You haven't told us what the problem is.

And please edit your code to include indentation. Nobody is going to try to read more than 500 lines of unindented code.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nobody is going to try to read more than 500 lines of unindented code.

I would go a step further, and venture to say to few people are going to read 500 lines of code, period.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic