Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8123243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:06:50+00:00 2026-06-06T06:06:50+00:00

I have an ArrayList of Routine objects and I must use this method to

  • 0

I have an ArrayList of Routine objects and I must use this method to update the various status of the task

    while(!allRoutineComplete){
        for (Routine routine : routineList) {
            if(!(routine.isBlocked()) && !(routine.isFinished())) {
                routine.run();
                }
        }
        for (Routine routine : routineList) {
            routine.updateStatus();
            if(routine.isFinished()){
                completedRoutineNumber++;
            }
            if(completedRoutineNumber==routineList.size()){
                allRoutineComplete=true;
            }
        }
    }

unfortunately the boolean allRoutineComplete in the my implementation is setted as true before the finish of all the Routine.

What is wrong in my code?

How to check efficently the finish of all tasks?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T06:06:54+00:00Added an answer on June 6, 2026 at 6:06 am

    You must move the all Routine Complete check, in the first for cycle, otherwise the routine finished loop more times.

    Try to use this:

    while(!allRoutineComplete){
                for (Routine routine : routineList) {
                    if(!(routine.isBlocked()) && !(routine.isFinished())) {
                        routine.run();
                        if(routine.isFinished()){
                            completedRoutineNumber++;
                        }
                        if(completedRoutineNumber==routineList.size()){
                        allRoutineComplete=true;
                        }
                    }
                }
                for (Routine routine : routineList) {
                    routine.updateStatus();
                }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ArrayList that I want to use to hold RaceCar objects that
I have arraylist myorderdata . I want to retrieve this arraylist to one String
At the moment inside the class I have ArrayList which the objects are stored
I have an ArrayList of Timestamps. I want to split this ArrayList into several
I have an arraylist with objects and a running Gui. I looking for a
I have an ArrayList in Java, which contains Objects, these Objects are made of
I have an ArrayList of objects of my custom class. I would like to
I have this arrayList: ArrayList<ArrayList<Integer>> temporary = new ArrayList<ArrayList<Integer>>(); Some how I need to
i have an ArrayList that looks like this: [ 1 2011-05-10 1 22.0, 2
I have static ArrayList<Batch> . i want to remove which object contain productcode This

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.