Java Stream of toStream(final Iterable iterable)

Here you can find the source of toStream(final Iterable iterable)

Description

to Stream

License

Apache License

Declaration

public static <T> Stream<T> toStream(final Iterable<T> iterable) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

import java.util.stream.Stream;

public class Main {
    public static <T> Stream<T> toStream(final Iterable<T> iterable) {
        return toList(iterable).stream();
    }/*ww w.  ja  va  2  s  .  co  m*/

    public static <T> List<T> toList(final Iterable<T> iterable) {
        List<T> list = new ArrayList<>();
        for (final T item : iterable) {
            list.add(item);
        }
        return list;
    }
}

Related

  1. streamScanner(Scanner scanner)
  2. streamToList(Stream stream)
  3. toParallelStream(Iterator iter)
  4. toStream(Collection collection)
  5. toStream(Enumeration e)
  6. toStream(final Iterable iterable)
  7. toStream(final T source)
  8. toStream(Iterable iterable)
  9. toStream(Iterator iter, boolean parallel)