Permutation { @SafeVarargs @SuppressWarnings("varargs") public static <T> Stream<Stream<T>> of(final T... items) { return PermutationUtil.of(items); } private  Permutation(); static long factorial(final int n); static List<T> permutation(final long no, final List<T> items); @SafeVarargs @SuppressWarnings("varargs") static Stream<Stream<T>> of(final T... items); static Stream<Stream<T>> of(final List<T> items);  }
@Test void of() { final List<List<Integer>> expected = expectedFor123(); final List<List<Integer>> actual = Permutation.of(1,2,3) .map(s -> s.collect(toList())) .collect(toList()); assertEquals(expected, actual); }
@Test void ofList() { final List<List<Integer>> expected = expectedFor123(); final List<List<Integer>> actual = Permutation.of(LIST) .map(s -> s.collect(toList())) .collect(toList()); assertEquals(expected, actual); }