title: Can I duplicate a Stream in Java 8?
body: <p>Sometimes I want to perform a set of operations on a stream, and then process the resulting stream two different ways with other operations.</p>
  
  <p>Can I do this without having to specify the common initial operations twice?</p>
  
  <p>For example, I am hoping a <code>dup()</code> method such as the following exists:</p>
  
  <pre><code>Stream [] desired_streams = IntStream.range(1, 100).filter(n -&gt; n % 2 == 0).dup();
  Stream stream14 = desired_streams[0].filter(n -&gt; n % 7 == 0); // multiples of 14
  Stream stream10 = desired_streams[1].filter(n -&gt; n % 5 == 0); // multiples of 10
  </code></pre>