class CollectionFunctions {

    public static <T> List<List<T>> findPermutations(List<T> excludedWords) {
        List<List<List<T>>> allPermutations = mapWithIndex(excludedWords, (i, currentWord) -> findPermutations(emptyList(), currentWord, removeElement(excludedWords, i)));
        return flattenLists(allPermutations);
    }

    private  CollectionFunctions();

}