我在 cardlist 数组中添加了一些数组索引。我想避免添加那些具有相同值的索引。我需要改变什么?
playerHand.player_hand.add(cardList.get(lastCardIndex));
playerHand.player_hand.add(cardList.get(lastCardIndex - 1));
playerHand.player_hand.add(cardList.get(lastCardIndex - 2));
playerHand.player_hand.add(cardList.get(lastCardIndex - 3));
playerHand.player_hand.add(cardList.get(lastCardIndex - 4));