Can't remove object from ArrayList
<p>I'm working on a card game. I can't figure out how to remove a Card from an ArrayList no matter what. This is the code I'm using:</p>

<pre><code>private List&lt;Card&gt; cardDeck = new ArrayList&lt;Card&gt;();

public void removeCard(Card card) {
    for (Iterator&lt;Card&gt; it = cardDeck.iterator(); it.hasNext();) {
        Card nextCard = it.next();
        if (nextCard.equals(card)) {
            cardDeck.remove(card);
            System.out.println("removed " + card);
        }
    }
}
</code></pre>

<p>And here's the card class, incase you need it:</p>

<pre><code>    public class Card {

    public Card(Rank rank, Suit suit) {
        this.rank = rank;
        this.suit = suit;
    }

    public Rank getRank() {
        return rank;
    }

    public Suit getSuit() {
        return suit;
    }

    @Override
    public String toString() {
        return getRank().toString().toLowerCase() + " of "
                + getSuit().toString().toLowerCase();
    }

    private Rank rank;

    private Suit suit;

}
</code></pre>

<p>I've tried everything but it just won't remove. Any tips?</p>
