class PermutationUtil {

    private PermutationUtil() {}

    public static long factorial(final int n) {
        if (n > 20 || n < 0) {
            throw new IllegalArgumentException(n + " is out of range");
        }
        return LongStream.rangeClosed(2, n).reduce(1, (a, b) -> a * b);
    }

    public static <T> List<T> permutation(final long no, final List<T> items) {
        return permutationHelper(no,
            new LinkedList<>(Objects.requireNonNull(items)),
            new ArrayList<>());
    }

    private static <T> List<T> permutationHelper(final long no, final LinkedList<T> in, final List<T> out) {<FILL_FUNCTION_BODY>}

    @SafeVarargs
    @SuppressWarnings("varargs") // Creating a List from an array is safe
    public static <T> Stream<Stream<T>> of(final T... items) {
        return of(Arrays.asList(items));
    }

    public static <T> Stream<Stream<T>> of(final List<T> items) {
        return LongStream.range(0, factorial(items.size()))
            .mapToObj(no -> permutation(no, items).stream());
    }

}

        if (in.isEmpty()) {
            return out;
        }
        final long subFactorial = factorial(in.size() - 1);
        out.add(in.remove((int) (no / subFactorial)));
        return permutationHelper((int) (no % subFactorial), in, out);
    
<no_super_class>