code: public static <T, U> Stream<U> cast(final Stream<T> stream, final Class<? extends U> type) {
          return stream.map(type::cast);
      }
docs: Cast all elements in a stream to a given type, possibly throwing a
  {@link ClassCastException}.
  
  <pre>
  {@code
  Streams.cast(Stream.of(1, "a", 2, "b", 3),Integer.class)
  // throws ClassCastException
  }