I'm building a poker game. Currenlty, I am trying to build a Straight method to check if the poker hand is a straight. I already sorted my ArrayList of Cards so all I have to do now is check if is a straight.
My Card class has a method called isNextSeq which checks if the Card object being passed to it is in sequence. Here it is below:
public boolean isNextSeq(Card c)
while(c != NULL) //***Need HELP Here***//
else return false;
Below is my driver method:
public void five_card_straight(ArrayList<Card> p)
Card newCard = new Card();
As you can see I am passing p.get(i+1) to the method. What happens when I reach the end of the for loop where i, is the last object of the ArrayList. i+1 is null.
My question is: In my Card class' method called isNextSeq, how do I check for NULL objects?