UPDATED CODE
I'm trying to figure out a way to count how often one value appears in an ArrayList.
System.out.println("Hand 1, Number of Clubs: "
+ hands[0].frequency(hands[0], Card.Suit.CLUBS));
So in the above case i want to count how many "Clubs" are in hands[0].
public int frequency(Hand c, Suit suit){
int count = 0;
if(suit == suit) //need this to be "If suit (club) is present, count++)
{
count++;
}
return count;
}
I'm drawing a blank.... If i change the method type to ArrayList then i cannot return "count"
hands[0] is created by:
Hand[] hands = new Hand[4];
for(int i=0; i<hands.length; i++) {
hands[i]=new Hand();
}
for(int i=0; i<=Deck.size()+8; i++) {
for(Hand hand:hands) {
hand.addSingleCard(Deck.deal());
}
}
if(suit == suit)