I have an array which stores info about 20 teams. I created another array which stores the exact info of the first array but the teams are shuffled. I also have a third array this time of 10 which is being used to store matches i.e. 10 matches between the 20 teams.
Now for the matches, I have a class which has the following constructor:
Now for the left and right team I want to pass the  and  from the shuffled array for match 1,  and  for match 2 etc.
So to populate the Match array I am trying to use the following code:
However, the system.out statement is not being displayed in the console. Any ideas what I am doing wrong?
when all else fails, pepper your code with more println statements. I have been known to put "entering method X" and "leaving method X" in every single method in my code to make sure methods I think are being called really are.
Once you are SURE that method is called, put on as the first thing in your loop: "entering the loop now!"
print your conditions, print when you increment your counters, etc.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
And check if size of mt is not 10. I see you are saying you have an array of size 10 to hold the matches. Then below will give exception when i in for is going beyond 10.
Joined: Jun 06, 2011
thank you for your replies. Regarding the loop going beyond 10, you were right and i changed it as follows:
However, this function is still not running at all, i am not even getting the "Started" print statement. The function the it is being called before it from the main is the following, which is the last thing that it is being run successfully(since the array is being shuffled).
the ft mentioned above is the original array before the teams are being shuffled.
Thank you for any feedback.
Joined: Jun 06, 2011
the problem seems to be coming from the shuffleTeams method because on line 19 in the above code, I added a simply system.out statement to display that the loop has ended, however not even this print statement is being shown in the console. Therefore the console is just showing the 20 teams shuffled and the program is ending their.
Any feedback would be greatly appreciated, as I cannot understand what I am doing wrong.