Java Stream of toStream(Collection collection)

Here you can find the source of toStream(Collection collection)

Description

to Stream

License

Apache License

Declaration

private static <T> Stream<T> toStream(Collection<T> collection) 

Method Source Code

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

import java.util.Collection;

import java.util.stream.Stream;

public class Main {
    private static <T> Stream<T> toStream(Collection<T> collection) {
        if (collection == null) {
            return Stream.empty();
        } else {/*from w  w w.ja v a2  s .  c o  m*/
            return collection.stream();
        }
    }
}

Related

  1. streamOfOptional(Optional element)
  2. streamOrEmpty(Iterable iterable)
  3. streamScanner(Scanner scanner)
  4. streamToList(Stream stream)
  5. toParallelStream(Iterator iter)
  6. toStream(Enumeration e)
  7. toStream(final Iterable iterable)
  8. toStream(final Iterable iterable)
  9. toStream(final T source)