title: How to use conditional filter and map with stream()
body: <p>I am trying to stream a <code>List</code> of Type A and based on conditions, map them to another Object of Type B.</p>
  
  <p>Below is the structure of my classes.</p>
  
  <pre><code>public class A {
         private String   color;
         private Integer  actualValue;
         private Integer  expectedValue;
  }
  
  public class B {
         private Green green;
         private Yellow yellow;
         private Red red;
  }
  
  
  public class Green {
         private Integer  actualValue;
         private Integer  expectedValue;
  }
  </code></pre>
  
  <p>... and the same structure of class Green, for class Yellow and Red as well.</p>
  
  <p>My expectation is to use one <code>listA.stream()</code> and do the below mapping:</p>
  
  <pre><code>if(colorFromListA.equals("green") {
    //then set the "actualValue" from ListA to "actualValue" of 
      Class Green
  }
  else if (colorFromListA.equals("yellow") {
    //then set the "actualValue" from ListA to "actualValue" of Class Yellow
  }
  </code></pre>
  
  <p>....and so on.</p>
  
  <p>I have tried using the <code>.filter()</code> and <code>.map()</code> but however I am not sure how to use conditions in filter and do different mapping.</p>
  
  <p>Can someone please assist.</p>