title: How to get values from a list that has child lists and store all the values in order in another list
body: <p>I have a list named ionList which has values named structs in it.
  Each struct in the list has more lists and those lists has some more structs in it. You can imagine it like kind of a parent list and child lists</p>
  
  <p>I want to retrieve all the structs in the ionList completely and store it in one list named StructList.</p>
  
  <p>The code i used is a recursive code but the data is getting lost when i call the recursive function whenevr i encounter a child list in my ionList.</p>
  
  <pre><code>    public List&lt;IonStruct&gt; findStructsFromParentList(IonList ionList) {
          String objectType = "object_type";
          String diffType = "diff_type";
          String childList = "children";
          IonList ionChildList = null;
          IonList ionChildList1 = null;
          List&lt;IonStruct&gt; ionStructList = new ArrayList&lt;IonStruct&gt;();
          System.out.println("ION LIST"+ionList.size());
          for (int index = 0; index &lt; ionList.size();index++) {
              ionStructList.add((IonStruct) ionList.get(index));
              ionChildList = (IonList) ionStructList.get(index).get(childList);
              if (ionChildList != null) {
                  System.out.println("Found child");
                  ionStructList.addAll(findStructsFromParentList(ionChildList));
  
              }
  
          }
  
          return ionStructList;
  
  
      }
  </code></pre>
  
  <p>The childList found is altering my for loop initialisation in my recursive call which i think is the reason for not parsing more than one struct with child lists in it. Please help me out..</p>