I'm having trouble with a class I wrote containing an ArrayList.
Code:
import java.util.ArrayList;
public class AscendingPile {
 public ArrayList<Integer> pile = new ArrayList<Integer>() {{
     add(1);
 }};
public void lay(int card) throws IllegalArgumentException{
    int lastCard = pile.get(pile.size() - 1);
    if(card > lastCard || card == lastCard - 10){
        pile.add(card);
    }
    else {
        throw new IllegalArgumentException("....");
    }
}
// returns last card on the deck
public int getCard() {
    return pile.get(pile.size() - 1);
}
}
Problem is the lay method: Instead of defining a new local variable I want the if statement to look something like this:
if(card > pile.getCard() || card == pile.getCard() - 10)
but IntelliJ says cannot resolve symbol getCard()
How can I change my code to obtain the desired result?
 
     
     
    