I wanted to make a method to check if I can see if each of my piles have 6 cards in it. This is my method
public boolean checkIfPileHasSixCards() {
map.put("tpile1", tpile1);
map.put("tpile2", tpile2);
map.put("tpile3", tpile2);
for (ArrayList<Card> value : map.values()) {
int size=value.size();
if(size==6) {
return true;
}
}
return false;
}
Is my logic correct, is there a more efficient way I can iterate over the values and check if each value (ArrayList) size is 6?