@SuppressWarnings("unchecked")
    static <T> Seq<T> seq(Stream<? extends T> stream) {
        if (stream == null)
            return Seq.empty();
        
        if (stream instanceof Seq)
            return (Seq<T>) stream;

        return new SeqImpl<>(stream);
    }
Wrap a <code>Stream</code> into a <code>Seq</code>.
jOOL-java-8/src/main/java/org/jooq/lambda/Seq.java