title: Java init object and set property using Stream
body: <p>I'm trying to clone a list to a new list and set a property in the new list.
  I'm trying to use Java8 Stream as it makes cloning simple.
  My code works but it gives this code smell from Sonar:</p>
  
  <blockquote>
    <p>Local variables should not be declared and then immediately returned or thrown (squid:S1488)</p>
  </blockquote>
  
  <p>Is there a way to do this without using a local variable?
  code:</p>
  
  <pre><code>List&lt;myObject&gt; clonedList = listToClone.stream()
                                                  .map(item -&gt;  {
                                                      cloned = new myObject(item);
                                                      cloned.setLifeCycle("someLifeCycle");
                                                      return cloned;
                                                  })
                                                  .collect(Collectors.toList());
  </code></pre>
  
  <p>Thanks</p>