This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Iterator usage Sample demo Required Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Iterator usage Sample demo Required" Watch "Iterator usage Sample demo Required" New topic
Author

Iterator usage Sample demo Required

Comal Rajagopalaratnam Muthukumar
Ranch Hand

Joined: Mar 18, 2012
Posts: 89
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

Joined: Aug 05, 2005
Posts: 3602
    
  15
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.

Joanne
Comal Rajagopalaratnam Muthukumar
Ranch Hand

Joined: Mar 18, 2012
Posts: 89
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

Joined: Aug 05, 2005
Posts: 3602
    
  15
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
Marshal

Joined: Mar 22, 2005
Posts: 42030
    
  64
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.


Ping & DNS - my free Android networking tools app
 
 
subject: Iterator usage Sample demo Required