title: scala flatten List(List(List(String, List(String, String)
body: <p>after pattern matching BasicDBobject from mongo casbas i get something Like that:</p>
  
  <pre><code>val arr = List(Some(None), 
                 List(List(Some(None),
                           Some(None),
                           Some("54c22f3369702d7fdb8c0100"),
                           Some(None),
                           Some(None),
                           Some(None),
                           Some(None)),
                      List(Some(None), 
                           Some(None),
                           Some("54c22f3369702d7fdb8c0100"),
                           Some(None),
                           Some(None),
                           Some(None), 
                           Some(None)),
                      List(Some(None),
                           Some(None),
                           Some("54c22f3369702d7fdb8c0100"),
                           Some(None),
                           Some(None),
                           Some(None),
                           Some(None))),
                      Some(None))
  </code></pre>
  
  <p>I need flatten this in <code>List(Some(none), Some(string) ..)</code>  in one list. How i can did this?</p>
  
  <p>example what i need from arr:</p>
  
  <pre><code>    List( Some("54c22f3369702d7fdb8c0100"), 
  Some("54c22f3369702d7fdb8c0100"),  
  Some("54c22f3369702d7fdb8c0100") )
  </code></pre>
  
  <p>I get arr by this code:</p>
  
  <pre><code>val subjectUsers = x.map {
          case ("entries", y: BasicDBList) =&gt; y(0) match {
            case entries: BasicDBList =&gt; entries.toList map {
              case z: BasicDBObject =&gt; z.toList map {
                case ("type", "subscribe") =&gt; Some(z("subject_id"))
                case ("info", v: BasicDBObject) =&gt; Some(v("user"))
                case _ =&gt; Some(None)
              }
              case _ =&gt; Some(None)
            }
          }
          case _ =&gt; Some(None)
        }.toList
  </code></pre>
  
  <p>I need only List(String) like</p>
  
  <pre><code>List( Some("54c22f3369702d7fdb8c0100"), Some("54c22f3369702d7fdb8c0100"))
  </code></pre>