wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes While-loop , can't BREAK Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "While-loop , can Watch "While-loop , can New topic
Author

While-loop , can't BREAK

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
I am doing a List filter. for example, in the coding below, I am trying to filter the people whose age is 30.

But it can NOT jump out the while-loop, when it should break. I don't know why ? THe coding is complete, you could test it.

Thanks for your help.

Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

You're looping in two different ways: the "while true" loop, and a recursive call to the same routine. The recursive call is unnecessary; after modifying the list, you can just let the loop go again.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: While-loop , can't BREAK