I am trying to generate all permutations of a List<List<String>> but I am not getting unique permutations.
My List<List<String>> looks something like
[
 [Test, Test 1, Test 2],
 [Apple, Sandwich, Banana],
 [Cake, Ice Cream, Fruit]
] 
I am trying to get every combination possible for each List<String within the parent List<String>. So, for example, the first instance should have:
[Test, Test 1, Test 2]
[Test, Test 2, Test 1]
[Test 2, Test, Test 1]
[Test 2, Test 1, Test]
[Test 1, Test, Test 2]
[Test 1, Test 2, Test]
Right now, my attempt will just iterate and repeat the elements without changing the order so [Test, Test 1, Test 2] will just be repeated for the size of the parent List<String>. This is my approach. Any help is appreciated:
List<List<String>> allPerms = parentList.stream().map(line -> parentList.stream()).flatMap(l -> l.filter(j -> !j.equals(l))).collect(Collectors.toList());
 
     
    