How to design a returned stream that may use skip
<p>I have created a parsing library that accepts a provided input and returns a stream of Records.  A program then calls this library and processes the results.  In my case, my program is using something like </p>

<pre><code>recordStream.forEach(r -&gt; insertIntoDB(r));
</code></pre>

<p>One of the types of input that can be provided to the parsing library is a flat file, which may have a header row.  As such, the parsing library can be configured to skip a header row.  If a header row is configured, it adds a skip(n) element to the return, e.g. </p>

<pre><code>Files.lines(input)**.skip(1)**.parallel().map(r -&gt; createRecord(r));  
</code></pre>

<p>The parsing library returns the resulting Stream.</p>

<p>But, it seems that skip, parallel and forEach do not play nicely togetherThe end programmer must instead invoke forEachOrdered, but it is poor design to put this requirement on the programmer, to expect them to know they must use forEachOrdered if dealing with an input type of a file with a header row.</p>

<p>How can I enforce the ordered requirement myself when necessary, within the construction of the returned stream chain, to return a fully functional stream to the program writer, instead of a stream with hidden limitations?  Is the answer to wrap the stream in another stream?</p>