public static getDeck(ArrayList<Integer> cards) {
for (int total = 1; total !=5; total++) {
for (int suit = 1; suit != 14; suit++) {
cards.add(suit);
}
}
Collections.shuffle(cards); // Randomize the list
return cards;
}
public static void main(String[] args) {
// Create the cards here.
ArrayList<Integer> cards = new ArrayList<>();
cards = getDeck(cards);
}
I would like to be able to call the function getDeck which will add 52 numbers to the Arraylist I pass to it. In this case cards. Then return this Object and set it to cards.
The error I am getting is so.