title: List iteration & setting values with Java 8 Streams API
body: <p>I'm trying to understand how to use the Java 8 Streams API.</p>
  
  <p>For example, I have these two classes:</p>
  
  <pre><code>public class User {
      private String name;
      public String getName() { return name; }
      public void setName(String name) { this.name = name; }
  }
  
  public class UserWithAge {
      private String name;
      public String getName() { return name; }
      public void setName(String name) { this.name = name; }
  
      private int age;
      public int getAge() { return age; }
      public void setAge(int age) { this.age = age; }
  }
  </code></pre>
  
  <p>I have a <code>List&lt;User&gt;</code> of ten users, and I want to convert this to a <code>List&lt;UserWithAge&gt;</code> of ten users with the same names and with a constant age (say, 27). How can I do that using the Java 8 Streams API (without loops, and without modifying the above classes)?</p>