title: Java 8 Lambda: Can I generate a new ArrayList of objects from an IntStream?
body: <p>I have a Card class</p>
  
  <pre><code>public class Card {
  
     private int value, suit;
  
     public Card(int value, int suit) {
         this.value = value;
         this.suit = suit;
     }
  
     //gets, sets, toString
  }
  </code></pre>
  
  <p>This is how I would normally fill the ArrayList of Card</p>
  
  <pre><code>for(int suit = 1; suit &lt;= 4; ++suit)
      for(int value = 1; value &lt;= 13; ++value)
          Cards.add(new Card(value, suit));
  </code></pre>
  
  <p>But I want to use a Lambda expression to initialize it</p>
  
  <pre><code>ArrayList&lt;Card&gt; Cards = IntStream.range(1, 4)
                             .map(value -&gt; IntStream.range(1, 13)
                                 .map(suit -&gt; new Card(value, suit)));
  </code></pre>
  
  <p>Intellij is giving me an error under <code>.map(suit -&gt; new Card(suit, value))</code></p>
  
  <p>It says "Incompatible return type Card in lambda expression"</p>