title: Flattening an Iterable<Iterable<T>> in Guava
body: <p>Is there a <code>flatten</code> method in Guava - or an easy way to convert an <code>Iterable&lt;Iterable&lt;T&gt;&gt;</code> to an <code>Iterable&lt;T&gt;</code>?</p>
  
  <p>I have a <code>Multimap&lt;K, V&gt;</code> [sourceMultimap] and I want to return all values where the key matches some predicate [keyPredicate]. So at the moment I have:</p>
  
  <pre><code>Iterable&lt;Collection&lt;V&gt;&gt; vals = Maps.filterKeys(sourceMultimap.asMap(), keyPredicate).values();
  
  Collection&lt;V&gt; retColl = ...;
  for (Collection&lt;V&gt; vs : vals) retColl.addAll(vs);
  return retColl;
  </code></pre>
  
  <p>I've looked through the Guava docs, but nothing jumped out. I am just checking I've not missed anything. Otherwise, I'll extract my three lines into a short flatten generic method and leave it as that.</p>