private static List<String> multiply(List<String> x, List<String> y) {
List<String> results = new ArrayList<>();
x.forEach(s1 -> y.forEach(s2 ->
results.add(s1+s2 )
)
);
return results;
}
public static void main(String[] args) {
String[] x = {"a", "b", "c"};
String[] y = {"d", "e", "f", "g"};
String[] z = {"h", "i"};
List<List<String>> inputs = Arrays.asList(Arrays.asList(x),Arrays.asList(y),Arrays.asList(z));
List<String> results = Arrays.asList("");
for (int i = 0; i < inputs.size(); i++) {
results = multiply(results, inputs.get(i));
}
System.out.println("results = " + results);
}
cdi ceh cei cfh cfi cgh cgi