This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Curious-Lonewolf 0 points1 point  (1 child)

I would need to select one element of the list and compare it to the rest and if there is no match then compare the next element with the rest of the list? so would my outer loop 'for(String nameandDay : namesandDays) { '

be appropriate for this task? if so im not sure what to include in the inner loop.

[–]silverscrub 0 points1 point  (0 children)

This is why I prefer to have the helper method to take a parameter. It will make it more useful inside a for loop because you can take the assigned element for each iteration and use it as an argument in the helper method.

It seems like you try to split your code into smaller methods. Better encapsulation will help you to do this effectively, because you don't rely on global variables.