I have the following bunch of arrays:
public class ArrayPermutationExample {
private static final String PREFIX = "ignore(FAILURE) { build(\"load\", ";
public static final String ENDING = ")}";
private static String[] arr_1 = new String[] {
"111",
"222",
"333"};
private static String[] arr_2 = new String[]{
"aaa",
"bbb",
"ccc"};
private static String[] arr_3 = new String[] {
"***",
"&&&",
"$$$"};
I need to find permutation with other arrays, excluding native array.
The output should look like:
111aaa
111bbb
111ccc
111***
111&&&
111$$$
222aaa
222bbb
222ccc
...
333aaa
333bbb
333ccc
...
Finally, for all those permutations should be added prefix and ending:
prefixpermutation stringendings
And at the end we should have something like:
ignore(FAILURE) { build("load", 111aaa )}
I completely stuck with a solution for this task:
private static void processArrays(String[] ... arrays) {
ArrayList<String> result = new ArrayList<>();
for (String[] array : arrays) {
String[] currentArray = array;
for (String line : currentArray) {
// exclude all lines from current array & make concatenation with every line from others
}
}
}
How to solve this issue?
UPDATE:
I want to add that finally, we need to have a distinct list without any dublications. Even following example will be duplicating each other:
111aaa***
***111aaa
I believe that this task should have a solution with Java 8 style.