code: @SuppressWarnings("unchecked")
      public static <T, U> Stream<U> ofType(final Stream<T> stream, final Class<? extends U> type) {
          return stream.filter(type::isInstance)
                       .map(t -> (U) t);
      }
docs: Keep only those elements in a stream that are of a given type.
  
  
  assertThat(Arrays.asList(1, 2, 3),
  equalTo( Streams.ofType(Stream.of(1, "a", 2, "b", 3,Integer.class));