title: Map only non-nil values
body: <p>I am serialising some json into objects with a failable json initialiser like this:</p>
  
  <pre><code> sections = {
          let sectionJsons = json["sections"] as! [[String:AnyObject]]
          return sectionJsons.map {
              DynamicSection($0)
          }
      }()
  </code></pre>
  
  <p>DynamicSection's init: </p>
  
  <pre><code>init?(_ json:[String:AnyObject]) {
      super.init()
      //Boring stuff that can fail
  </code></pre>
  
  <p>I want to only append the DynamicSections that passed the init to sections. How can I accomplish this?</p>
  
  <p>I <em>can</em> use <code>filter</code>+<code>map</code> like </p>
  
  <pre><code>return sectionJsons.filter { DynamicSection($0) != nil }.map { DynamicSection($0)! }
  </code></pre>
  
  <p>But that leads to initing the DynamicSection twice, which i'd like to avoid. Is there any better way to do this?</p>