@SafeVarargs
    @SuppressWarnings("varargs") // Creating a List from an array is safe
    public static <T> Stream<List<T>> of(final T... items) {
        return IntStream.rangeClosed(1, items.length)
            .mapToObj(r -> {
                @SuppressWarnings("unchecked")
                final T[] data = (T[]) new Object[r];
                return combinationHelper(items, data, 0, items.length - 1, 0, r);
            }).flatMap(identity());
    }
Creates and returns all possible combinations of the given elements.

The order of the combinations in the stream is unspecified.

@param <T> element type
@param items to combine
@return all possible combinations of the given elements
common-parent/combinatorics/src/main/java/com/speedment/common/combinatorics/internal/CombinationUtil.java