title: How to flatmap multiple elements with Java 8 streams?
body: <p>I have a class</p>
  
  <pre><code>public class Step
        {
           boolean isActive;
           String name;
        }
  </code></pre>
  
  <p>I have a Collection of type Steps.
  Without using streams this is what I have currently</p>
  
  <pre><code>  StringBuilder stringBuilder = new StringBuilder();
    for (Step step : steps)
    {
       List&lt;String&gt; nextStepNames = getNextStepNames(step);
       List&lt;String&gt; conditions = getConditions(step);
       for (int i = 0; i &lt; nextStepNames.size(); i++)
       {
          stringBuilder.append("If ").append(step.getName()).append("is active, and condition (").append(conditions.get(i)).append(") is true, then move to ").append(nextStepNames.get(i)).append("\n");
       }
    }
  </code></pre>
  
  <p>If my step collection contains stepA, StepB and stepC,
   then this is my output:</p>
  
  <pre><code>If stepA is active, and condition (c1A) is true, then move to step1A
  If stepA is active, and condition (c2A) is true, then move to step2A
  If stepA is active, and condition (c3A) is true, then move to step3A
  If stepB is active, and condition (c1B) is true, then move to step1B
  If stepB is active, and condition (c2B) is true, then move to step2B
  If stepB is active, and condition (c3B) is true, then move to step3B
  If stepC is active, and condition (c1C) is true, then move to step1C
  If stepC is active, and condition (c2C) is true, then move to step2C
  If stepC is active, and condition (c3C) is true, then move to step3C
  </code></pre>
  
  <p>The <code>nextStepNames</code> and <code>conditions</code> list are the same size and the indexes in the lists correspond to each other.</p>
  
  <p>I haven't been able to convert this code into streams. I not sure if its possible.</p>