title: Experiencing Code Coverage issue only when using Stream
body: <p>I have the following 2 logics and both produces same result tested against same test but the one that is implemented with a Streams produces code coverage issue with 80% and the one using for loop has no code coverage issue. Could I get some advice on why this is the case? Thanks.</p>
  <p>This has no code coverage issues</p>
  <pre><code>public static Map&lt;String, String&gt; myMethod(List&lt;KafkaHeader&gt; headers) {
  
      Map&lt;String, String&gt; map = new HashMap&lt;&gt;();
  
      for(KafkaHeader header : headers) {
          map.put(header.key(), String.valueOf(header.value()));
      }
      return map;
  }
  </code></pre>
  <p>When using Stream as follows, there is coverage issue.</p>
  <pre><code>public static Map&lt;String, String&gt; myMethod(List&lt;KafkaHeader&gt; headers) {
      return headers.stream()
          .collect(Collectors.toMap(KafkaHeader::key, kafkaHeader -&gt; String.valueOf(kafkaHeader.value())));
  }
  </code></pre>
  <p>Test case:</p>
  <pre><code>@Test
  public void simpleTest() {
  
      List&lt;KafkaHeader&gt; headers = new ArrayList&lt;&gt;();
  
      for (int i = 0; i &lt; 10; i++) {
          headers.add(new KafkaHeader(&quot;key&quot;+i, &quot;value&quot;+i));
      }
  
      Map&lt;String, String&gt; headerMap = myclass.myMethod(headers);
  
      for (int i = 0; i &lt; 10; i++) {
          assertEquals(headerMap.get(&quot;key&quot;+i), &quot;value&quot;+i);
      }
  }
  </code></pre>
  <p>Note: KafkaHeader is an external class.</p>