• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Iterator usage Sample demo Required

 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic