Answer:
public static ArrayList manyStrings(ArrayList<String> list, int n){
ArrayList<String> newList = new ArrayList<String>();
for (int i=0; i<list.size(); i++) {
for (int j=0; j<n; j++) {
newList.add(list.get(i));
}
}
return newList;
}
Step-by-step explanation:
Create a method called manyStrings that takes two parameters, list and n
Create a new ArrayList that will hold new values
Create a nested for loop. The outer loop iterates through the list. The inner loop adds the elements, n of this element, to the newList.
When the loops are done, return the newList