hi
@david
i am explaining what i have understood . Please rectify me where i am wrong.
1) when there is a call to Card.newDeck() the Card class is initialized in the following order
static initializations
(a) each enum constants are constructed by default constructor of Rank,Suit respectively
(b)Then prototypeDeck is constructed from ArrayList of 52
(c)then the static block is run which adds card object to prototypeDeck in add() by getting the enum values from Rank,Suit
2)after the call to Card.newDeck(), deck gets a list of card objects then it randomizes the list by shuffle()
3)After that dealHand(deck,cardsPerHand) is evaluated for each iteration before passing it to System.out.println()
inside the body of dealHand, it returns the sorted array list (hand) which is made out using the sublist got out of deck ,
the sorting is defined in the compareTo() of Card class which first prioritizes suit then based on rank
(if they are not same suit type )
4)since the card class uses toString() , the output is printed in the manner " rank of suit "
but i am some where missing the call to
public Rank rank() { return rank;}
and
public Suit suit() { return suit;}