code: public static <T> Stream<T> stream(Stream<T> stream, boolean parallel) {
          if(parallel) {
              return stream.parallel();
          }
          else {
              return stream.sequential();
          }
      }
docs: Converts an Stream to parallel or sequential .
  
  @param <T>
  @param stream
  @param parallel
  @return