code: public static <T> StreamEx<T> of(Stream<T> stream) {
          if (stream instanceof AbstractStreamEx) {
              AbstractStreamEx<T, ?> ase = (AbstractStreamEx<T, ?>) stream;
              if (ase.spliterator != null)
                  return new StreamEx<>(ase.spliterator(), ase.context);
              return new StreamEx<>(ase.stream(), ase.context);
          }
          return new StreamEx<>(stream, StreamContext.of(stream));
      }
docs: Returns an {@link StreamEx} object which wraps given {@link Stream}.
  
  <p>
  The supplied stream must not be consumed or closed when this method is
  called. No operation must be performed on the supplied stream after it's
  wrapped.
  
  @param <T> the type of stream elements
  @param stream original stream
  @return the wrapped stream