I'm having a lot of trouble turning an array into an ArrayList
in Java. This is my array right now:
Card[] hand = new Card[2];
"hand" holds an array of "Cards". How this would look like as an ArrayList
?
This will give you a list.
List<Card> cardsList = Arrays.asList(hand);
If you want an arraylist, you can do
ArrayList<Card> cardsList = new ArrayList<Card>(Arrays.asList(hand));