IterableView extends ForwardingObject implements Iterable<T> { @SuppressWarnings("unchecked") public Stream<T> stream() { if (delegate() instanceof Collection) { return ((Collection<T>) delegate()).stream(); } return StreamSupport.stream(spliterator(), false); }  static IterableView<T> of(final Iterable<? extends T> it); static IterableView<T> of(T... elements); IterableView<T> concat(Iterable<? extends T>... inputs); IterableView<T> concat(Iterable<? extends T> b, Iterable<? extends T> c); IterableView<T> concat(Iterable<? extends T> b); IterableView<T> filter(Predicate<? super T> predicate); IterableView<U> filter(final Class<? extends U> type); IterableView<U> transform(Function<? super T, ? extends U> function); IterableView<T> skip(int numberToSkip); IterableView<T> limit(int limitSize); IterableView<T> consumingIterable(); IterableView<T> cycle(); IterableView<T> unmodifiableIterable(); IterableView<List<T>> partition(final int size); boolean contains(@Nullable Object element); T find(Predicate<? super T> predicate); int frequency(@Nullable Object element); int size(); boolean all(Predicate<? super T> predicate); boolean any(Predicate<? super T> predicate); boolean isEmpty(); T get(int position); T get(int position, @Nullable T defaultValue); T getLast(); T getLast(@Nullable T defaultValue); T getOnlyElement(); T getOnlyElement(@Nullable T defaultValue); T getFirst(); ImmutableList<T> immutableCopy(); ImmutableSet<T> immutableSetCopy(); @SuppressWarnings({"rawtypes", "unchecked"}) S copyInto(S collection); @Override Iterator<T> iterator(); @Override @SuppressWarnings("unchecked") Spliterator<T> spliterator(); @SuppressWarnings("unchecked") Stream<T> stream(); @Override String toString();  }
@Test public void stream() { assertThat(IterableView.of(ImmutableList.of("a", "b")).stream()).containsExactly("a", "b"); assertThat(IterableView.of( Iterables.limit(Iterables.cycle(ImmutableSet.of("a", "b", "c")), 4)).stream()) .containsExactly("a", "b", "c", "a"); assertThat(IterableView.of(ImmutableList.of("a", "b")).transform(String::toUpperCase) .stream()) .containsExactly("A", "B"); }