I am trying to implement this method:
public ArrayList<ArrayList> groupWords(ArrayList<String> scrambledWords, int groupNumber); The method takes an ArrayList of Strings and a number that represents the number of words in each group as parameters and then returns an ArrayList made of ArrayLists that contain groups of words according to the groupNumber parameter. For example, there is an ArrayList of 20 strings and I want to group that ArrayList into groups of 5 so I call the method like this:
ArrayList<ArrayList> groupedWords = groupWords(ArrayList, 5); I am pretty sure that I need to have a for loop with another for loop nested inside, but I am not sure how to implement it.
How do I implement this method?