User Story
Create a static class method that takes a parameter and creates a list with n number of fruits in it, then returns the list.
Expected Outcome
(Fruit 1, Fruit 2, Fruit 3, ......)
Codes
public class StringArrayTest {
public static List<String> generateStringArray(Integer n) {
List<String> fruits = new ArrayList<>();
for (Integer i = 0; i < n; i++) {
fruits.add('Fruit ' + i);
}
return fruits;
}
}