package org.luxons.sevenwonders.game;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.luxons.sevenwonders.game.cards.Card;

public class Decks {

    private Map<Integer, List<Card>> cardsPerAge = new HashMap<>();

    public Decks(Map<Integer, List<Card>> cardsPerAge) {
        this.cardsPerAge = cardsPerAge;
    }

    public List<Card> getCards(int age) {
        return cardsPerAge.getOrDefault(age, Collections.emptyList());
    }
}

@@ -49,27 +49,25 @@
 va.util.
-Collections
+ArrayList
 ;%0Aimport
@@ -203,16 +203,61 @@
 ecks %7B%0A%0A
+    private static final int HAND_SIZE = 7;%0A%0A
     priv
@@ -429,115 +429,1028 @@
     
-public List%3CCard%3E getCards(int age) %7B%0A        return cardsPerAge.getOrDefault(a
+Map%3CInteger, List%3CCard%3E%3E deal(int age, int nbPlayers) %7B%0A        List%3CCard%3E deck = getDeck(age);%0A        validateNbCards(deck, nbPlayers);%0A        return deal(deck, nbPlayers);%0A    %7D%0A%0A    private List%3CCard%3E getDeck(int age) %7B%0A        List%3CCard%3E deck = cardsPerAge.get(age);%0A        if (deck == null) %7B%0A            throw new IllegalArgumentException(%22No deck found for age %22 + age);%0A        %7D%0A        return deck;%0A    %7D%0A%0A    private void validateNbCards(List%3CCard%3E deck, int nbPlayers) %7B%0A        if (nbPlayers * HAND_SIZE != deck.size()) %7B%0A            throw new IllegalArgumentException(%0A                    String.format(%22%25d cards is not the expected number for %25d players%22, deck.size(), nbPlayers));%0A        %7D%0A    %7D%0A%0A    private Map%3CInte
 ge
+r
 , 
-Collections.empt
+List%3CCard%3E%3E deal(List%3CCard%3E deck, int nbPlayers) %7B%0A        Map%3CInteger, List%3CCard%3E%3E hands = new HashMap%3C%3E(nbPlayers);%0A        for (int i = 0; i %3C deck.size(); i++) %7B%0A            hands.putIfAbsent(i %25 nbPlayers, new Arra
 yList
+%3C%3E
 ())
+.add(deck.get(i));%0A        %7D%0A        return hands
 ;%0A  

Add deal() method to the Decks