title: Why does Iterable<T> not provide stream() and parallelStream() methods?
body: <p>I am wondering why the <code>Iterable</code> interface does not provide the <code>stream()</code> and <code>parallelStream()</code> methods. Consider the following class:</p>
  
  <pre><code>public class Hand implements Iterable&lt;Card&gt; {
      private final List&lt;Card&gt; list = new ArrayList&lt;&gt;();
      private final int capacity;
  
      //...
  
      @Override
      public Iterator&lt;Card&gt; iterator() {
          return list.iterator();
      }
  }
  </code></pre>
  
  <p>It is an implementation of a <em>Hand</em> as you can have cards in your hand while playing a Trading Card Game.</p>
  
  <p>Essentially it wraps a <code>List&lt;Card&gt;</code>, ensures a maximum capacity and offers some other useful features. It is better as implementing it directly as a <code>List&lt;Card&gt;</code>.</p>
  
  <p>Now, for convienience I thought it would be nice to implement <code>Iterable&lt;Card&gt;</code>, such that you can use enhanced for-loops if you want to loop over it. (My <code>Hand</code> class also provides a <code>get(int index)</code> method, hence the <code>Iterable&lt;Card&gt;</code> is justified in my opinion.)</p>
  
  <p>The <code>Iterable</code> interface provides the following (left out javadoc):</p>
  
  <pre><code>public interface Iterable&lt;T&gt; {
      Iterator&lt;T&gt; iterator();
  
      default void forEach(Consumer&lt;? super T&gt; action) {
          Objects.requireNonNull(action);
          for (T t : this) {
              action.accept(t);
          }
      }
  
      default Spliterator&lt;T&gt; spliterator() {
          return Spliterators.spliteratorUnknownSize(iterator(), 0);
      }
  }
  </code></pre>
  
  <p>Now can you obtain a stream with:</p>
  
  <pre><code>Stream&lt;Hand&gt; stream = StreamSupport.stream(hand.spliterator(), false);
  </code></pre>
  
  <p>So onto the real question:</p>
  
  <ul>
  <li>Why does <code>Iterable&lt;T&gt;</code> not provide a default methods that implement <code>stream()</code> and <code>parallelStream()</code>, I see nothing that would make this impossible or unwanted?</li>
  </ul>
  
  <p>A related question I found is the following though: <a href="https://stackoverflow.com/questions/20129762/why-does-streamt-not-implement-iterablet">Why does Stream&lt;T&gt; not implement Iterable&lt;T&gt;?</a><br>
  Which is oddly enough suggesting it to do it somewhat the other way around.</p>