Arraylist of objects empty?

so in this class for the choice == 1, it does not go into the for loop through the ArrayList of objects, does it mean the object is empty? because i declared objects at the beginning and added them to the ArrayList store.

public static void main(String[] args) {
        ArrayList<Team> store = new ArrayList<>();
        Random gener = new Random();
        String tourName , tourDate , location;
        int maxNumberofTeams , avalSoft, avalHard , avalFieldTest;
        Scanner input = new Scanner(System.in);
        System.out.print("Please Enter tournament Name?\n");
        tourName = input.next();
        System.out.print("please Enter tournament Date\n");
        tourDate = input.next();
        System.out.print("please Enter location\n");
        location = input.next();
        System.out.print("Please Enter Max number of Teams\n");
        maxNumberofTeams = input.nextInt();
        System.out.print("Please Enter avalSoft\n");
        avalSoft = input.nextInt();
        System.out.print("Please enter aval Hard\n");
        avalHard = input.nextInt();
        System.out.print("Please Enter avalFieldTest\n");
        avalFieldTest = input.nextInt();
        Tournament tour = new Tournament (tourName , tourDate, location , maxNumberofTeams, avalSoft , avalHard, avalFieldTest);
        for (int i = 1 ; i <= maxNumberofTeams ; i++)
        {
            String teamName , sponsoringSchool , financialSponsor , judgeLocation;
            int teamNumber , noOfTeamMem , robotId;
            System.out.print("Please Enter %s team Name\n");
            teamName = input.next();
            System.out.print("Number of Team Memebers\n");
            noOfTeamMem = input.nextInt();
            System.out.print("Please Enter Sponsoring Schoolr\n");
            sponsoringSchool = input.next();
            System.out.print("Please Enter financialSponsor\n");
            financialSponsor = input.next();
            System.out.print("Please Enter judge Location\n");
            judgeLocation = input.next();
            teamNumber = i;
            System.out.print("Please Enter an ID for robot\n");
            robotId = input.nextInt();
            Robot robbb = new Robot();
            Team team = new Team(teamName , teamNumber , noOfTeamMem , sponsoringSchool , financialSponsor, judgeLocation, robbb);
            Robot rob = new Robot (team , robbb);
            store.add(team);
        }
        int choice=0;
        while(choice >= 0)
          {
            System.out.print("MENU\n"
                    + "1)PREPARING TEAM TURN ROBOT ON\n"
                    +"2)PREPARING TEAM HARDWARE\n"
                    + "3)HAVE HW INSPECT READY ROBOT\n"
                    + "4)HAVE PRERPARING TEAM TAKE HW_INSPECTED ROBOT TO STATION\n"
                    + "5)HAVE SW INSPECT ROBOT\n"
                    + "6)HAVE A PREPARING TEAM TAKE TO FIELD TEST\n"
                    + "7)HAVE A FIELD TEST INSPEC\n"
                    + "8)HAVE A BEFORE TEAM GO TO JUDGE\n"
                    + "9)HAVE JUDGES INTERVIEW\n"
                    + "10)CHANGE TEAM STATUS TO PASSED_INSPECTION\n"
                    + "11)TOURNAMENT STATUS TO MATCH\n"
                    + "12)\n"
                    + "13)ROBOT CAN'T PLAY IF OFF, READY, OR STILL AT TESTING\n"
                    + "14)CHANGE TOURNAMENT TO MATCHES\n"
                    + "15)GENERATE POINTS\n"
                    + "16)JUDGE POINTS\n"
                    + "17)CHANGE TOURNAMENT TO AWARDS\n"
                    + "18)PRINT TOP TEAMS JUDGING\n"
                    + "19) PRINT TOP BY QULIFYING \n"
                    + "20)DISPLAY TEAM PERSONS\n"
                    + "21)DISPLAY TEAM INFO\n"
                    + "22)DISPLAY INFO ABOUT ROBOTS\n"
                    + "23)INFO ABOUT TOURNAMENT\n"
                    + "24)END\n");

            choice = input.nextInt();
            Team temp = new Team();
            Robot robottemp = new Robot();
            Tournament tourr = new Tournament();
            if (choice == 1)
            {
                System.out.print("Phase"+choice);
                for (int i = 0 ; i >= store.size(); i++)
                {
                    System.out.print("Phase"+choice);
                    store.get(i).teamStatus = temp.teamStatus.PREPARING;
                    if (store.get(i).teamStatuss == 1)
                    {
                     store.get(i).robot.robotStatusChoice(1);
                     System.out.print("PHASE 1 COMPLETED\n");
                    }
                }
            }

This is the robot class in which i called the method;

public int teamNumber;
    public int robotId;
    public Robot robot;
    Random gener = new Random();
    public int robotStatusChoice;
    ArrayList stations = new ArrayList();
    public int Height;
    public int Width = 22;
    public int Depth;
    public Team TeamAssigned = new Team("TEAMNAME", 1 , 1, "SS", "FS", "JL",robot);
    public robotStatus robotStatus;

    public Robot()
    {

    }
    public Robot( Team TeamAssigned ,Robot  robot){
        this.robot = robot;
        this.TeamAssigned = TeamAssigned;
    }


public void robotStatusChoice(int i) {
            if (i == 1)
            {
                this.robotStatusChoice = i;
                this.robotStatus = robotStatus.READY;
            }
            else if( i == 2)
            {
                this.robotStatusChoice = i;
                this.robotStatus = robotStatus.HW_INSP_PASSED;
            }
            else if ( i == 3)
            {
                this.robotStatusChoice = i;
                this.robotStatus = robotStatus.FIELD_TEST_PASSED;
            }
            else if ( i > 3 || i < 1)
            {
                this.robotStatusChoice = i;
                this.robotStatus = robotStatus.READY;
            }
        }

TeamSTatus Change ;

public void TeamStatus(int x)
    {
        if( x == 1 )
        {
            this.teamStatuss = x;
            this.teamStatus = teamStatus.PREPARING;
        }
        else if ( x == 2)
        {
            this.teamStatuss = x;
            this.teamStatus = teamStatus.PASSED_INSPECTION;
        }
        else if ( x == 3 )
        {
            this.teamStatuss = x;
            this.teamStatus = teamStatus.PLAYED5_MATCHES;
        }
        else if ( x == 4)
        {
            this.teamStatuss = x;
            this.teamStatus = teamStatus.INELIGIBLE;
        }
        else if ( x > 4 || x<1)
        {
            this.teamStatuss = x;
            this.teamStatus = teamStatus.INELIGIBLE;
        }


    }
Jon Skeet
people
quotationmark

This is the problem:

for (int i = 0 ; i >= store.size(); i++)

Unless store is empty (in which case you'll get an exception), i >= store.size() will immediately be false. You meant:

for (int i = 0; i < store.size(); i++)

Or better yet, use an enhanced for loop:

for (Team team : store) {
    team.teamStatus = temp.teamStatus.PREPARING;
    if (team.teamStatuss == 1) {
        team.robot.robotStatusChoice(1);
        System.out.print("PHASE 1 COMPLETED\n");
    }
}

(Do you really have both teamStatus and teamStatuss as fields? That doesn't sound like a good idea to me.)

people

See more on this question at Stackoverflow