title: How to extract an object from a List of object in Java 8?
body: <p>I have a list of object A (Folder). Each object A in this list has a list of object B (Partners) and the object B has also a list of Object C (Personnes). The object C contains an attribute code that i want to use to filter using java 8.</p>
  <p>I've tried the code bellow but it doesnt seem to work :</p>
  <pre><code>A objectA = new A();
  String code = &quot;O&quot;;
  for (A a: listObjectsA) {
      for (B b: a.getPartners()) {
          for (C c: b.getPersonnes()) {
              if (c.getCode().equalsIgnoreCase(code)) {
                  objectA = a;
                  break;
              }
          }
      }
  }
  </code></pre>
  <p>Do you guys have an idea how can i use FlatMap to do this kind of conversion from <code>List&lt;A&gt;</code> to <code>A</code> ?</p>