code: public static <T> Stream<T> buildStream(boolean isParallel,
              Collection<T> collection) {
          return isParallel ? collection.parallelStream() : collection.stream();
      }
docs: Build stream stream.
  
  @param <T>        the type parameter
  @param isParallel the is parallel
  @param collection the collection
  @return the stream