I am trying to make a poker game and would like to transfer data between my ArrayList “deck” and have another list “hand”. I have hard-coded my list to include all 52 cards in a standard deck and want to pop the first card off of the list deck to the list hand by referencing the location of the card in the deck. Due to shuffling the deck I can’t reference the name of the card to transfer it and just need the location of the card to transfer to the hand. Does anyone know a function to do this, a way to hard-code this or even where to look. I can clarify anything if needed.
Share
If both
handanddeckare of typeArrayList<Card>then it’s simply:Note that
ArrayListisn’t a particularly good class for this, as it’s not designed for efficient removal of entries other than at the end of the list.