@@ -0,0 +1,1631 @@
+package in.webplay.poker;%0A%0Aimport java.util.*;%0A%0Apublic class Deck %7B%0A%0A    private List%3CCard%3E cards = new ArrayList%3CCard%3E();%0A    private int top = 0;%0A%0A    public Deck() %7B%0A        for (Card.Suit suit : Card.Suit.values()) %7B%0A            for (Card.Rank rank : Card.Rank.values()) %7B%0A                cards.add(new Card(rank, suit));%0A            %7D%0A        %7D%0A    %7D%0A%0A    public int size() %7B%0A        return cards.size() - top;%0A    %7D%0A%0A    // deal requested number of cards, or all remaining cards in deck if less%0A    public List%3CCard%3E deal(int num) %7B%0A        int remaining = cards.size() - top;%0A        int numCards = num %3C remaining ? num : remaining;%0A        int toIndex = top + numCards;%0A        List%3CCard%3E toDeal = cards.subList(top, toIndex);%0A        top += numCards;%0A        return toDeal;%0A    %7D%0A%0A    public void shuffle() %7B%0A        Collections.shuffle(this.cards);%0A        top = 0;%0A    %7D%0A%0A    // display the un-dealt cards remaining in the deck%0A    public String toString() %7B%0A        List%3CCard%3E unDealt = cards.subList(top, cards.size());%0A        return Deck.cardsToString(unDealt, %22,%22);%0A    %7D%0A%0A    // return a String representation of a list of Cards%0A    public static String cardsToString(List%3CCard%3E cards, String delimiter) %7B%0A        StringBuilder sb = new StringBuilder();%0A        String prefix = %22%22;%0A        for (Card card : cards) %7B%0A            sb.append(prefix);%0A            sb.append(card.toString());%0A            prefix = delimiter;%0A        %7D%0A        return sb.toString();%0A    %7D%0A%0A    // using a default delimiter%0A    public static String cardsToString(List%3CCard%3E cards) %7B%0A        return Deck.cardsToString(cards, %22 %22);%0A    %7D%0A%7D%0A

Add src for Deck class