title: What is the relation between Iterable and Iterator?
body: <p>What is the difference between <code>Iterator</code> and <code>Iterable</code> in scala?</p>
  
  <p>I thought that <code>Iterable</code> represents a set that I can iterate through, and <code>Iterator</code> is a "pointer" to one of the items in the iterable set.</p>
  
  <p>However, <code>Iterator</code> has functions like <code>forEach</code>, <code>map</code>, <code>foldLeft</code>. It can be converted to <code>Iterable</code> via <code>toIterable</code>. And, for example, <code>scala.io.Source.getLines</code> returns <code>Iterator</code>, not <code>Iterable</code>.</p>
  
  <p>But I cannot do <code>groupBy</code> on <code>Iterator</code> and I can do it on <code>Iterable</code>.</p>
  
  <p>So, what's the relation between those two, <code>Iterator</code> and <code>Iterable</code>?</p>