title: Java8 Stream with Multiple List of Objects
body: <p>I have two List where i want to perform some operations based on the properties of the Object1 and Object2.</p>
  
  <p>Object1: </p>
  
  <pre><code>public class Object1 {
          private String prop1;
          private String prop2;
  }
  </code></pre>
  
  <p>Object2: </p>
  
  <pre><code>public class Object2 {
          private String prop1;
          private String prop2;
          private String prop3;
          private boolean prop4;
  }
  </code></pre>
  
  <p>I want to use streams instead of having big methods around.</p>
  
  <p>Lets say we have the below Lists:</p>
  
  <pre><code>List&lt;Object1&gt; object1List = // List of Object1's
  List&lt;Object2&gt; object2List = // List of Object2's
  </code></pre>
  
  <p>Now, I want to compare prop1 and prop2 from both lists and if they are equal i want to get prop3 from Object2 and based on prop3 now i want to see all elements with prop4 true from Object2 and make sure that all with true .</p>
  
  <p>Example:</p>
  
  <pre><code>Object1:
  prop1  |  prop2
  test1     value1
  test1     value2
  
  Object2:
  prop1 | prop2 | prop3 | prop4
  test1   value1  some    true
  test1   value2  some1   true
  test2   value3  some    true
  </code></pre>
  
  <p>Now from the above example, i want to stream both the list and compare the list and if both the prop1 and prop2 are equal, i want to get prop3 in the case "some" and get all prop4 values "true" with prop3 value "some" and see if prop1 and prop2 are in the first list of Object and collect them in a set. I can do this in traditional way but streams seems more readable with less lines of code. I am just learning streams any ideas are appreciated!</p>