title: Make a Stream into an Iterable?
body: <p><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/stream/Stream.html" rel="noreferrer"><code>Stream</code></a> inherits an <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/stream/BaseStream.html#iterator()" rel="noreferrer">iterator()</a> method to produce an <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Iterator.html" rel="noreferrer"><code>Iterator</code></a>. </p>
  
  <p>But I need an <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Iterable.html" rel="noreferrer"><code>Iterable</code></a> rather than an <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Iterator.html" rel="noreferrer"><code>Iterator</code></a>. </p>
  
  <p>For example, given this string:</p>
  
  <pre><code>String input = "this\n" +
          "that\n" +
          "the_other";
  </code></pre>
  
  <p>…I need to pass those parts of string as an <code>Iterable</code> to a specific library. Calling <code>input.lines()</code> yields a <code>Stream</code>. So I would be set if I could make that <code>Stream</code> into a <code>Iterable</code> of its elements.</p>