Here you can find the source of asStream(Collection
Parameter | Description |
---|---|
T | the generic type |
source | the source |
parallel | <code>true</code> if the stream should be a parallel stream |
public static <T> Stream<T> asStream(Collection<T> source, boolean parallel)
//package com.java2s; //License from project: LGPL import java.util.Collection; import java.util.stream.Stream; public class Main { /**/* w w w .ja va 2s . co m*/ * Returns the given collection as stream. * * @param <T> * the generic type * @param source * the source * @param parallel * <code>true</code> if the stream should be a parallel stream * @return the stream */ public static <T> Stream<T> asStream(Collection<T> source, boolean parallel) { return parallel ? source.parallelStream() : source.stream(); } }