Results 1 to 2 of 2
  1. #1
    The_Freeman is offline Member
    Join Date
    Apr 2013
    Rep Power

    Default Pause ForEach Loop using Thread

    Hi Guys,

    As you may have noticed I am new to this forum and ... I can admit yes even to java(even though I have knowledge in other languages). :)

    I am having an issue with threads. What I am trying to do(an not managing is this)

    I have a List of Objects which I am looping through. Once I find the Object I need from the List, I am storing it in another Object, Now what I need to do is stop the loop(using threads) until I change some properties of that Object using buttons(which I have implemented + their Listeners), Once the properties are modified I need to notify() the thread again to continue. Can some one please guide me through this process. I have searched google a lot for some sample code without success.


  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power

    Default Re: Pause ForEach Loop using Thread

    I'm not sure that threading is the way to go here, but if you're set on doing it anyway, I would take a look at the wait() and notify() methods in the concurrency tutorials.
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

Similar Threads

  1. foreach loop on ArrayList<Stack<String>>
    By Ciwan in forum New To Java
    Replies: 21
    Last Post: 06-27-2011, 08:29 PM
  2. make thread to pause execution
    By Saran185 in forum Threads and Synchronization
    Replies: 1
    Last Post: 03-16-2011, 06:01 AM
  3. Once again: waiting in a thread loop.
    By willemjav in forum Threads and Synchronization
    Replies: 115
    Last Post: 09-22-2008, 02:35 PM
  4. Replies: 3
    Last Post: 06-06-2008, 12:10 AM
  5. Question regarding foreach loop...
    By theonlywalks in forum New To Java
    Replies: 2
    Last Post: 03-15-2008, 07:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts